UPSTREAM: virt_wifi: fix error return code in virt_wifi_newlink()
authorWei Yongjun <weiyongjun1@huawei.com>
Fri, 18 Jan 2019 07:29:52 +0000 (07:29 +0000)
committerAlistair Strachan <astrachan@google.com>
Mon, 22 Apr 2019 21:19:31 +0000 (14:19 -0700)
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: c7cdba31ed8b ("mac80211-next: rtnetlink wifi simulation device")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
(cherry picked from commit f9d672f1c2ca36b788511bbd773d650c744e109a)
Change-Id: Ia6290ab996afca7b33e1a8e9b8bcfc0ecbe252f4
Signed-off-by: Cody Schuffelen <schuffelen@google.com>
drivers/net/wireless/virt_wifi.c

index 2e21ffee9b0e427f2ac3582125ccd9782a81b153..815de4f2ff4c346232d25302eafd8a46fb19744c 100644 (file)
@@ -530,8 +530,10 @@ static int virt_wifi_newlink(struct net *src_net, struct net_device *dev,
        SET_NETDEV_DEV(dev, &priv->lowerdev->dev);
        dev->ieee80211_ptr = kzalloc(sizeof(*dev->ieee80211_ptr), GFP_KERNEL);
 
-       if (!dev->ieee80211_ptr)
+       if (!dev->ieee80211_ptr) {
+               err = -ENOMEM;
                goto remove_handler;
+       }
 
        dev->ieee80211_ptr->iftype = NL80211_IFTYPE_STATION;
        dev->ieee80211_ptr->wiphy = common_wiphy;