diff options
Diffstat (limited to 'drivers/media/video/gspca/gspca.c')
-rw-r--r-- | drivers/media/video/gspca/gspca.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index 2ed24527ecd6..65e4901f4db7 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c | |||
@@ -422,6 +422,7 @@ static void destroy_urbs(struct gspca_dev *gspca_dev) | |||
422 | if (urb == NULL) | 422 | if (urb == NULL) |
423 | break; | 423 | break; |
424 | 424 | ||
425 | BUG_ON(!gspca_dev->dev); | ||
425 | gspca_dev->urb[i] = NULL; | 426 | gspca_dev->urb[i] = NULL; |
426 | if (!gspca_dev->present) | 427 | if (!gspca_dev->present) |
427 | usb_kill_urb(urb); | 428 | usb_kill_urb(urb); |
@@ -1950,8 +1951,12 @@ void gspca_disconnect(struct usb_interface *intf) | |||
1950 | { | 1951 | { |
1951 | struct gspca_dev *gspca_dev = usb_get_intfdata(intf); | 1952 | struct gspca_dev *gspca_dev = usb_get_intfdata(intf); |
1952 | 1953 | ||
1954 | mutex_lock(&gspca_dev->usb_lock); | ||
1953 | gspca_dev->present = 0; | 1955 | gspca_dev->present = 0; |
1956 | mutex_unlock(&gspca_dev->usb_lock); | ||
1954 | 1957 | ||
1958 | destroy_urbs(gspca_dev); | ||
1959 | gspca_dev->dev = NULL; | ||
1955 | usb_set_intfdata(intf, NULL); | 1960 | usb_set_intfdata(intf, NULL); |
1956 | 1961 | ||
1957 | /* release the device */ | 1962 | /* release the device */ |