[media] dvb_usb_v2: do not try to remove non-existent adapter
authorAntti Palosaari <crope@iki.fi>
Wed, 27 Jun 2012 01:49:19 +0000 (22:49 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 4 Aug 2012 10:56:39 +0000 (07:56 -0300)
Check that adapter exists before trying to remove it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/dvb-usb/dvb_usb_core.c

index 920542c0b672b3bc0db705f91e1d14e5c23bcc65..aed7463167bceb7a54e869e8ece0e60471012c1e 100644 (file)
@@ -717,9 +717,11 @@ static int dvb_usbv2_adapter_exit(struct dvb_usb_device *d)
        dev_dbg(&d->udev->dev, "%s:\n", __func__);
 
        for (i = MAX_NO_OF_ADAPTER_PER_DEVICE - 1; i >= 0; i--) {
-               dvb_usbv2_adapter_frontend_exit(&d->adapter[i]);
-               dvb_usbv2_adapter_dvb_exit(&d->adapter[i]);
-               dvb_usbv2_adapter_stream_exit(&d->adapter[i]);
+               if (d->adapter[i].props) {
+                       dvb_usbv2_adapter_frontend_exit(&d->adapter[i]);
+                       dvb_usbv2_adapter_dvb_exit(&d->adapter[i]);
+                       dvb_usbv2_adapter_stream_exit(&d->adapter[i]);
+               }
        }
 
        return 0;