staging: rtl8192u: remove redundant nul check on pointer dev
authorColin Ian King <colin.king@canonical.com>
Mon, 4 Feb 2019 15:18:43 +0000 (15:18 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 7 Feb 2019 12:33:54 +0000 (13:33 +0100)
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 <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8192u/r8192U_core.c

index 0ac0bbf7d923193940ee8f1ed7ca1a6bbfcf0318..f1eaab337dca1f7561aa4927d9a5fe9ce67bacce 100644 (file)
@@ -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");
 }