diff options
author | Alexey Khoroshilov | 2013-04-24 01:27:39 +0200 |
---|---|---|
committer | Greg Kroah-Hartman | 2013-05-13 23:50:06 +0200 |
commit | 657d4c86d4cd85a4696445f6fb2fe0941a5724ff (patch) | |
tree | e5650cce8ab3f4f466ecbdf5fed7271471a7a5d0 /drivers/staging/wlags49_h2/wl_cs.c | |
parent | staging: cptm1217: don't call input_free_device() after input_unregister_devi... (diff) | |
download | kernel-qcow2-linux-657d4c86d4cd85a4696445f6fb2fe0941a5724ff.tar.gz kernel-qcow2-linux-657d4c86d4cd85a4696445f6fb2fe0941a5724ff.tar.xz kernel-qcow2-linux-657d4c86d4cd85a4696445f6fb2fe0941a5724ff.zip |
staging: wlags49_h2: fix error handling in pcmcia probe function
wl_adapter_attach() ignores some important issues
such as register_netdev() failure. The patch fixes it.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wlags49_h2/wl_cs.c')
-rw-r--r-- | drivers/staging/wlags49_h2/wl_cs.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/staging/wlags49_h2/wl_cs.c b/drivers/staging/wlags49_h2/wl_cs.c index 7c7c77f9c862..f9e5fd3b02cd 100644 --- a/drivers/staging/wlags49_h2/wl_cs.c +++ b/drivers/staging/wlags49_h2/wl_cs.c @@ -133,6 +133,7 @@ static int wl_adapter_attach(struct pcmcia_device *link) { struct net_device *dev; struct wl_private *lp; + int ret; /*--------------------------------------------------------------------*/ DBG_FUNC("wl_adapter_attach"); @@ -154,10 +155,12 @@ static int wl_adapter_attach(struct pcmcia_device *link) lp = wl_priv(dev); lp->link = link; - wl_adapter_insert(link); + ret = wl_adapter_insert(link); + if (ret != 0) + wl_device_dealloc(dev); DBG_LEAVE(DbgInfo); - return 0; + return ret; } /* wl_adapter_attach */ /*============================================================================*/ @@ -224,7 +227,7 @@ static int wl_adapter_resume(struct pcmcia_device *link) return 0; } /* wl_adapter_resume */ -void wl_adapter_insert(struct pcmcia_device *link) +int wl_adapter_insert(struct pcmcia_device *link) { struct net_device *dev; int ret; @@ -267,13 +270,13 @@ void wl_adapter_insert(struct pcmcia_device *link) " %pM\n", dev->name, dev->base_addr, dev->irq, dev->dev_addr); DBG_LEAVE(DbgInfo); - return; + return 0; failed: wl_adapter_release(link); DBG_LEAVE(DbgInfo); - return; + return ret; } /* wl_adapter_insert */ /*============================================================================*/ |