From 5e767cca2964d6225ca6eebe2efade6e0fe99557 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Mon, 4 Feb 2019 15:18:43 +0000 Subject: [PATCH] staging: rtl8192u: remove redundant nul check on pointer dev There is a null check on pointer dev which implies it may be null, however dev can never be null as it is set in rtl8192_usb_probe via the call to usb_set_intfdata. Detected by CoverityScan, CID#143078 ("Dereference after null check") Fixes: 8fc8598e61f6 ("Staging: Added Realtek rtl8192u driver to staging") Signed-off-by: Colin Ian King Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U_core.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 0ac0bbf7d923..f1eaab337dca 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -4957,20 +4957,18 @@ static void rtl8192_usb_disconnect(struct usb_interface *intf) struct net_device *dev = usb_get_intfdata(intf); struct r8192_priv *priv = ieee80211_priv(dev); - if (dev) { - unregister_netdev(dev); - - RT_TRACE(COMP_DOWN, - "=============>wlan driver to be removed\n"); - rtl8192_proc_remove_one(dev); - - rtl8192_down(dev); - kfree(priv->pFirmware); - priv->pFirmware = NULL; - rtl8192_usb_deleteendpoints(dev); - usleep_range(10000, 11000); - } + unregister_netdev(dev); + + RT_TRACE(COMP_DOWN, "=============>wlan driver to be removed\n"); + rtl8192_proc_remove_one(dev); + + rtl8192_down(dev); + kfree(priv->pFirmware); + priv->pFirmware = NULL; + rtl8192_usb_deleteendpoints(dev); + usleep_range(10000, 11000); free_ieee80211(dev); + RT_TRACE(COMP_DOWN, "wlan driver removed\n"); } -- 2.30.2