From: Stanislaw Gruszka Date: Sat, 16 Mar 2013 18:19:29 +0000 (+0100) Subject: rt2800: do not crash if spec->channels is NULL X-Git-Tag: v3.10-rc2~34^2~21^2^2~262 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=53216d6a9a2dd3b0a65203e540b7739c36351d55;p=platform%2Fkernel%2Flinux-3.10.git rt2800: do not crash if spec->channels is NULL In case the spec->channels was not specified, print warning instead of hard crash the kernel. Signed-off-by: Stanislaw Gruszka Tested-by: Wanlong Gao Signed-off-by: John W. Linville --- diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index a658b4b..182e598 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c @@ -5213,6 +5213,9 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev) spec->channels = rf_vals_3x; } + if (WARN_ON_ONCE(!spec->channels)) + return -ENODEV; + /* * Initialize HT information. */