Staging: wlags49_h2: potential NULL dereference
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 14 May 2012 20:56:46 +0000 (23:56 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 May 2012 22:43:44 +0000 (15:43 -0700)
wl_device_dealloc() dereferences the "dev" paramter, so let's move it
under the check for NULL.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wlags49_h2/wl_cs.c

index 7084f41..7c7c77f 100644 (file)
@@ -177,10 +177,9 @@ static void wl_adapter_detach(struct pcmcia_device *link)
        if (dev) {
                unregister_wlags_sysfs(dev);
                unregister_netdev(dev);
+               wl_device_dealloc(dev);
        }
 
-       wl_device_dealloc(dev);
-
        DBG_LEAVE(DbgInfo);
 } /* wl_adapter_detach */
 /*============================================================================*/