diff mbox series

[net-next] mac80211: fix error handling in ieee80211_register_hw()

Message ID 1537964237-169158-1-git-send-email-weiyongjun1@huawei.com (mailing list archive)
State Accepted
Delegated to: Johannes Berg
Headers show
Series [net-next] mac80211: fix error handling in ieee80211_register_hw() | expand

Commit Message

Wei Yongjun Sept. 26, 2018, 12:17 p.m. UTC
Fix to return a negative error code -ENOMEM from the kmemdup
error handling case instead of 0.

Fixes: 09b4a4faf9d0 ("mac80211: introduce capability flags for VHT EXT NSS support")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 net/mac80211/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 7738101..e6375d0 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -1203,8 +1203,10 @@  int ieee80211_register_hw(struct ieee80211_hw *hw)
 			continue;
 
 		sband = kmemdup(sband, sizeof(*sband), GFP_KERNEL);
-		if (!sband)
+		if (!sband) {
+			result = -ENOMEM;
 			goto fail_rate;
+		}
 
 		wiphy_dbg(hw->wiphy, "copying sband (band %d) due to VHT EXT NSS BW flag\n",
 			  band);