Make sure pdev is not dereferenced when it is null

Signed-off-by: Huzaifa Sidhpurwala <huzai...@redhat.com>
---
 drivers/media/video/pwc/pwc-if.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c
index 780af5f..356cd42 100644
--- a/drivers/media/video/pwc/pwc-if.c
+++ b/drivers/media/video/pwc/pwc-if.c
@@ -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);
 }
 
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to