Modified wilc_netdev_init() to return the error code received from register_netdev() during the failure condition. Earlier discussion link [1]. https://www.spinics.net/lists/linux-wireless/msg177304.html Suggested-by: Claudiu Beznea <claudiu.beznea@xxxxxxxxxxxxx> Signed-off-by: Ajay Singh <ajay.kathat@xxxxxxxxxxxxx> --- drivers/staging/wilc1000/linux_wlan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 29c1317..75abaf9 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1056,14 +1056,14 @@ static const struct net_device_ops wilc_netdev_ops = { int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, const struct wilc_hif_func *ops) { - int i, ret; + int i, ret = -ENOMEM; struct wilc_vif *vif; struct net_device *ndev; struct wilc *wl; wl = kzalloc(sizeof(*wl), GFP_KERNEL); if (!wl) - return -ENOMEM; + return ret; if (wilc_wlan_cfg_init(wl)) goto free_wl; @@ -1151,7 +1151,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, wilc_wlan_cfg_deinit(wl); free_wl: kfree(wl); - return -ENOMEM; + return ret; } EXPORT_SYMBOL_GPL(wilc_netdev_init); -- 2.7.4