From: Axel Lin Date: Mon, 10 Jan 2011 02:26:00 +0000 (+0800) Subject: iwmc3200wifi: Return proper error for iwm_if_alloc X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=35b3ac470b982ded560e1b2ec9206a8d186c3459;p=linux-beck.git iwmc3200wifi: Return proper error for iwm_if_alloc In the case of alloc_netdev_mq failure and kmalloc failure, current implementation returns ERR_PTR(0). As a result, the caller of iwm_if_alloc does not catch the error by IS_ERR macro. Fix it by setting proper error code for ret variable in the failure cases. Signed-off-by: Axel Lin Signed-off-by: John W. Linville --- diff --git a/drivers/net/wireless/iwmc3200wifi/netdev.c b/drivers/net/wireless/iwmc3200wifi/netdev.c index 13a69ebf2a94..5091d77e02ce 100644 --- a/drivers/net/wireless/iwmc3200wifi/netdev.c +++ b/drivers/net/wireless/iwmc3200wifi/netdev.c @@ -126,6 +126,7 @@ void *iwm_if_alloc(int sizeof_bus, struct device *dev, ndev = alloc_netdev_mq(0, "wlan%d", ether_setup, IWM_TX_QUEUES); if (!ndev) { dev_err(dev, "no memory for network device instance\n"); + ret = -ENOMEM; goto out_priv; } @@ -138,6 +139,7 @@ void *iwm_if_alloc(int sizeof_bus, struct device *dev, GFP_KERNEL); if (!iwm->umac_profile) { dev_err(dev, "Couldn't alloc memory for profile\n"); + ret = -ENOMEM; goto out_profile; }