diff options
author | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-12-28 09:55:49 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-01-11 12:19:15 -0200 |
commit | 9f80679511b0544d1ed8c9bc2d80030183e9f1ed (patch) | |
tree | 0aa38dd9818f88e48b4673c9862dfa1bd6e31084 /drivers/media/usb/cx231xx/cx231xx-cards.c | |
parent | 9832e155f1ed3030fdfaa19e72c06472dc2ecb1d (diff) |
[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/cx231xx/cx231xx-cards.c')
-rw-r--r-- | drivers/media/usb/cx231xx/cx231xx-cards.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c index de0026b5265c..620b83d03f75 100644 --- a/drivers/media/usb/cx231xx/cx231xx-cards.c +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c @@ -1206,7 +1206,7 @@ void cx231xx_release_resources(struct cx231xx *dev) clear_bit(dev->devno, &cx231xx_devused); } -static void cx231xx_media_device_init(struct cx231xx *dev, +static int cx231xx_media_device_init(struct cx231xx *dev, struct usb_device *udev) { #ifdef CONFIG_MEDIA_CONTROLLER @@ -1214,7 +1214,7 @@ static void cx231xx_media_device_init(struct cx231xx *dev, mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); if (!mdev) - return; + return -ENOMEM; mdev->dev = dev->dev; strlcpy(mdev->model, dev->board.name, sizeof(mdev->model)); @@ -1228,6 +1228,7 @@ static void cx231xx_media_device_init(struct cx231xx *dev, dev->media_dev = mdev; #endif + return 0; } static int cx231xx_create_media_graph(struct cx231xx *dev) @@ -1663,7 +1664,11 @@ static int cx231xx_usb_probe(struct usb_interface *interface, usb_set_intfdata(interface, dev); /* Initialize the media controller */ - cx231xx_media_device_init(dev, udev); + retval = cx231xx_media_device_init(dev, udev); + if (retval) { + dev_err(d, "cx231xx_media_device_init failed\n"); + goto err_media_init; + } /* Create v4l2 device */ #ifdef CONFIG_MEDIA_CONTROLLER @@ -1758,6 +1763,8 @@ err_video_alt: err_init: v4l2_device_unregister(&dev->v4l2_dev); err_v4l2: + cx231xx_unregister_media_device(dev); +err_media_init: usb_set_intfdata(interface, NULL); err_if: usb_put_dev(udev); |