diff options
| author | Navid Emamdoost <[email protected]> | 2019-07-24 09:17:36 -0500 |
|---|---|---|
| committer | Kalle Valo <[email protected]> | 2019-08-06 15:35:28 +0300 |
| commit | b95c732234fa40319c6aae2db6b35e9a7f41d79c (patch) | |
| tree | f8d8b99ae6ee301dc6a355b5ad21b4e0e80c3f72 | |
| parent | cddecd92d1ec2fd05ed1123455e7c6cf6906b5a5 (diff) | |
mt7601u: null check the allocation
devm_kzalloc may fail and return NULL. So the null check is needed.
Signed-off-by: Navid Emamdoost <[email protected]>
Acked-by: Jakub Kicinski <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
| -rw-r--r-- | drivers/net/wireless/mediatek/mt7601u/init.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/wireless/mediatek/mt7601u/init.c b/drivers/net/wireless/mediatek/mt7601u/init.c index 9bfac9f1d47f..cada48800928 100644 --- a/drivers/net/wireless/mediatek/mt7601u/init.c +++ b/drivers/net/wireless/mediatek/mt7601u/init.c @@ -557,6 +557,9 @@ mt76_init_sband_2g(struct mt7601u_dev *dev) { dev->sband_2g = devm_kzalloc(dev->dev, sizeof(*dev->sband_2g), GFP_KERNEL); + if (!dev->sband_2g) + return -ENOMEM; + dev->hw->wiphy->bands[NL80211_BAND_2GHZ] = dev->sband_2g; WARN_ON(dev->ee->reg.start - 1 + dev->ee->reg.num > |