From: Dan Carpenter Date: Mon, 14 May 2012 20:56:46 +0000 (+0300) Subject: Staging: wlags49_h2: potential NULL dereference X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=bed861ba2a020c267a987c63aca2705d460f1350;p=linux-beck.git Staging: wlags49_h2: potential NULL dereference wl_device_dealloc() dereferences the "dev" paramter, so let's move it under the check for NULL. Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/wlags49_h2/wl_cs.c b/drivers/staging/wlags49_h2/wl_cs.c index 7084f414846e..7c7c77f9c862 100644 --- a/drivers/staging/wlags49_h2/wl_cs.c +++ b/drivers/staging/wlags49_h2/wl_cs.c @@ -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 */ /*============================================================================*/