diff options
author | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-12-28 12:55:49 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-01-11 15:19:15 +0100 |
commit | 9f80679511b0544d1ed8c9bc2d80030183e9f1ed (patch) | |
tree | 0aa38dd9818f88e48b4673c9862dfa1bd6e31084 /drivers/media/usb/au0828 | |
parent | [media] media-device: split media initialization and registration (diff) | |
download | linux-9f80679511b0544d1ed8c9bc2d80030183e9f1ed.tar.xz linux-9f80679511b0544d1ed8c9bc2d80030183e9f1ed.zip |
[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/au0828')
-rw-r--r-- | drivers/media/usb/au0828/au0828-core.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c index fbdaeb206565..9e29e70a78d7 100644 --- a/drivers/media/usb/au0828/au0828-core.c +++ b/drivers/media/usb/au0828/au0828-core.c @@ -217,15 +217,15 @@ static void au0828_usb_disconnect(struct usb_interface *interface) au0828_usb_release(dev); } -static void au0828_media_device_init(struct au0828_dev *dev, - struct usb_device *udev) +static int au0828_media_device_init(struct au0828_dev *dev, + struct usb_device *udev) { #ifdef CONFIG_MEDIA_CONTROLLER struct media_device *mdev; mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); if (!mdev) - return; + return -ENOMEM; mdev->dev = &udev->dev; @@ -243,6 +243,7 @@ static void au0828_media_device_init(struct au0828_dev *dev, dev->media_dev = mdev; #endif + return 0; } @@ -368,7 +369,14 @@ static int au0828_usb_probe(struct usb_interface *interface, dev->board = au0828_boards[dev->boardnr]; /* Initialize the media controller */ - au0828_media_device_init(dev, usbdev); + retval = au0828_media_device_init(dev, usbdev); + if (retval) { + pr_err("%s() au0828_media_device_init failed\n", + __func__); + mutex_unlock(&dev->lock); + kfree(dev); + return retval; + } #ifdef CONFIG_VIDEO_AU0828_V4L2 dev->v4l2_dev.release = au0828_usb_v4l2_release; |