diff options
author | Christoph Fritz <chf.fritz@googlemail.com> | 2010-08-03 06:54:20 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-08-04 15:28:37 -0400 |
commit | 93c0584ca92a76bd458c7fd505b1747901315156 (patch) | |
tree | 478cf17692d48d846a1046e8260f04d75967475b /drivers | |
parent | c8f3b7213342d905cbb75d6c8820d9141205f3a0 (diff) |
wireless: ipw2100: check result of kzalloc()
If kzalloc() fails return with -ENOMEM from ipw2100_net_init() which is
called by register_netdev.
CC: Dan Carpenter <error27@gmail.com>
Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/ipw2x00/ipw2100.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c index 5bbff4c5a489..a146240f7ddb 100644 --- a/drivers/net/wireless/ipw2x00/ipw2100.c +++ b/drivers/net/wireless/ipw2x00/ipw2100.c | |||
@@ -1924,6 +1924,10 @@ static int ipw2100_net_init(struct net_device *dev) | |||
1924 | bg_band->channels = | 1924 | bg_band->channels = |
1925 | kzalloc(geo->bg_channels * | 1925 | kzalloc(geo->bg_channels * |
1926 | sizeof(struct ieee80211_channel), GFP_KERNEL); | 1926 | sizeof(struct ieee80211_channel), GFP_KERNEL); |
1927 | if (!bg_band->channels) { | ||
1928 | ipw2100_down(priv); | ||
1929 | return -ENOMEM; | ||
1930 | } | ||
1927 | /* translate geo->bg to bg_band.channels */ | 1931 | /* translate geo->bg to bg_band.channels */ |
1928 | for (i = 0; i < geo->bg_channels; i++) { | 1932 | for (i = 0; i < geo->bg_channels; i++) { |
1929 | bg_band->channels[i].band = IEEE80211_BAND_2GHZ; | 1933 | bg_band->channels[i].band = IEEE80211_BAND_2GHZ; |