[media] Prevent null pointer derefernce of pdev
authorHuzaifa Sidhpurwala <huzaifas@redhat.com>
Mon, 9 May 2011 10:32:24 +0000 (07:32 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 20 May 2011 22:55:57 +0000 (19:55 -0300)
Make sure pdev is not dereferenced when it is null

Signed-off-by: Huzaifa Sidhpurwala <huzaifas@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/pwc/pwc-if.c

index 780af5f81642f87ece0d11158a2ead78c70f2bb8..356cd42b593b3f36b72569d24217768c220e6c70 100644 (file)
@@ -1850,7 +1850,6 @@ static void usb_pwc_disconnect(struct usb_interface *intf)
        } else {
                /* Device is closed, so we can safely unregister it */
                PWC_DEBUG_PROBE("Unregistering video device in disconnect().\n");
-               pwc_cleanup(pdev);
 
 disconnect_out:
                /* search device_hint[] table if we occupy a slot, by any chance */
@@ -1860,6 +1859,7 @@ disconnect_out:
        }
 
        mutex_unlock(&pdev->modlock);
+       pwc_cleanup(pdev);
 }