staging: rtl8712: usb_intf.c: Fix for possible null pointer dereference
authorRickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Tue, 20 May 2014 21:34:25 +0000 (23:34 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 May 2014 16:58:22 +0000 (01:58 +0900)
There is otherwise a risk of a possible null pointer dereference.

Was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8712/usb_intf.c

index bbd5888..ba74354 100644 (file)
@@ -595,7 +595,7 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,
 error:
        usb_put_dev(udev);
        usb_set_intfdata(pusb_intf, NULL);
-       if (padapter->dvobj_deinit != NULL)
+       if (padapter && padapter->dvobj_deinit != NULL)
                padapter->dvobj_deinit(padapter);
        if (pnetdev)
                free_netdev(pnetdev);