summaryrefslogtreecommitdiff
path: root/drivers/media/usb/dvb-usb/dvb-usb-dvb.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-12-28 14:55:49 +0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-01-11 17:19:15 +0300
commit9f80679511b0544d1ed8c9bc2d80030183e9f1ed (patch)
tree0aa38dd9818f88e48b4673c9862dfa1bd6e31084 /drivers/media/usb/dvb-usb/dvb-usb-dvb.c
parent9832e155f1ed3030fdfaa19e72c06472dc2ecb1d (diff)
downloadlinux-9f80679511b0544d1ed8c9bc2d80030183e9f1ed.tar.xz
[media] usb: check media device errors
There are now two new warnings: drivers/media/usb/dvb-usb-v2/dvb_usb_core.c: In function 'dvb_usbv2_media_device_register': drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:433:2: warning: ignoring return value of '__media_device_register', declared with attribute warn_unused_result [-Wunused-result] media_device_register(adap->dvb_adap.mdev); ^ drivers/media/usb/dvb-usb/dvb-usb-dvb.c: In function 'dvb_usb_media_device_register': drivers/media/usb/dvb-usb/dvb-usb-dvb.c:128:2: warning: ignoring return value of '__media_device_register', declared with attribute warn_unused_result [-Wunused-result] media_device_register(adap->dvb_adap.mdev); ^ Those are because the drivers are not properly checking if the media device init and register were succeeded. Fix it. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/usb/dvb-usb/dvb-usb-dvb.c')
-rw-r--r--drivers/media/usb/dvb-usb/dvb-usb-dvb.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/media/usb/dvb-usb/dvb-usb-dvb.c b/drivers/media/usb/dvb-usb/dvb-usb-dvb.c
index 6a4bb2d86175..241463ef631e 100644
--- a/drivers/media/usb/dvb-usb/dvb-usb-dvb.c
+++ b/drivers/media/usb/dvb-usb/dvb-usb-dvb.c
@@ -95,7 +95,7 @@ static int dvb_usb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
return dvb_usb_ctrl_feed(dvbdmxfeed, 0);
}
-static void dvb_usb_media_device_init(struct dvb_usb_adapter *adap)
+static int dvb_usb_media_device_init(struct dvb_usb_adapter *adap)
{
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
struct media_device *mdev;
@@ -104,7 +104,7 @@ static void dvb_usb_media_device_init(struct dvb_usb_adapter *adap)
mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
if (!mdev)
- return;
+ return -ENOMEM;
mdev->dev = &udev->dev;
strlcpy(mdev->model, d->desc->name, sizeof(mdev->model));
@@ -120,12 +120,15 @@ static void dvb_usb_media_device_init(struct dvb_usb_adapter *adap)
dev_info(&d->udev->dev, "media controller created\n");
#endif
+ return 0;
}
-static void dvb_usb_media_device_register(struct dvb_usb_adapter *adap)
+static int dvb_usb_media_device_register(struct dvb_usb_adapter *adap)
{
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
- media_device_register(adap->dvb_adap.mdev);
+ return media_device_register(adap->dvb_adap.mdev);
+#else
+ return 0;
#endif
}
@@ -155,7 +158,11 @@ int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap, short *adapter_nums)
}
adap->dvb_adap.priv = adap;
- dvb_usb_media_device_init(adap);
+ ret = dvb_usb_media_device_init(adap);
+ if (ret < 0) {
+ deb_info("dvb_usb_media_device_init failed: error %d", ret);
+ goto err_mc;
+ }
if (adap->dev->props.read_mac_address) {
if (adap->dev->props.read_mac_address(adap->dev, adap->dvb_adap.proposed_mac) == 0)
@@ -205,6 +212,7 @@ err_dmx_dev:
dvb_dmx_release(&adap->demux);
err_dmx:
dvb_usb_media_device_unregister(adap);
+err_mc:
dvb_unregister_adapter(&adap->dvb_adap);
err:
return ret;
@@ -323,8 +331,10 @@ int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap)
return ret;
ret = dvb_create_media_graph(&adap->dvb_adap);
+ if (ret)
+ return ret;
- dvb_usb_media_device_register(adap);
+ ret = dvb_usb_media_device_register(adap);
return ret;
}