* [PATCH] media: au0828 analog_register error path fixes to do proper cleanup
@ 2014-12-31 0:22 Shuah Khan
2015-01-28 23:54 ` Shuah Khan
0 siblings, 1 reply; 2+ messages in thread
From: Shuah Khan @ 2014-12-31 0:22 UTC (permalink / raw)
To: mchehab, hans.verkuil, sakari.ailus, prabhakar.csengg,
laurent.pinchart
Cc: Shuah Khan, linux-media, linux-kernel
au0828_analog_register() doesn't release video and vbi queues
created by vb2_queue_init(). In addition, it doesn't unregister
vdev when vbi register fails. Add vb2_queue_release() calls to
release video and vbi queues to the failure path to be called
when vdev register fails. Add video_unregister_device() for
vdev when vbi register fails.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
Please note that this patch is dependent on the au0828 vb2
conversion patch.
drivers/media/usb/au0828/au0828-video.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c
index 94b65b8..17450eb 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -1785,7 +1785,7 @@ int au0828_analog_register(struct au0828_dev *dev,
dprintk(1, "unable to register video device (error = %d).\n",
retval);
ret = -ENODEV;
- goto err_vbi_dev;
+ goto err_reg_vdev;
}
/* Register the vbi device */
@@ -1795,14 +1795,18 @@ int au0828_analog_register(struct au0828_dev *dev,
dprintk(1, "unable to register vbi device (error = %d).\n",
retval);
ret = -ENODEV;
- goto err_vbi_dev;
+ goto err_reg_vbi_dev;
}
-
dprintk(1, "%s completed!\n", __func__);
return 0;
+err_reg_vbi_dev:
+ video_unregister_device(dev->vdev);
+err_reg_vdev:
+ vb2_queue_release(&dev->vb_vidq);
+ vb2_queue_release(&dev->vb_vbiq);
err_vbi_dev:
video_device_release(dev->vbi_dev);
err_vdev:
--
2.1.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] media: au0828 analog_register error path fixes to do proper cleanup
2014-12-31 0:22 [PATCH] media: au0828 analog_register error path fixes to do proper cleanup Shuah Khan
@ 2015-01-28 23:54 ` Shuah Khan
0 siblings, 0 replies; 2+ messages in thread
From: Shuah Khan @ 2015-01-28 23:54 UTC (permalink / raw)
To: mchehab, hans.verkuil, sakari.ailus, prabhakar.csengg,
laurent.pinchart
Cc: linux-media, linux-kernel
On 12/30/2014 05:22 PM, Shuah Khan wrote:
> au0828_analog_register() doesn't release video and vbi queues
> created by vb2_queue_init(). In addition, it doesn't unregister
> vdev when vbi register fails. Add vb2_queue_release() calls to
> release video and vbi queues to the failure path to be called
> when vdev register fails. Add video_unregister_device() for
> vdev when vbi register fails.
>
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> ---
> Please note that this patch is dependent on the au0828 vb2
> conversion patch.
I have to fold this patch into the vb2 conversion patch as
it no longer applies after the recent changes to address
comments on patch v3. I will fold it into vb2 convert patch v6.
It makes sense since vb2_queue_release() should be part of the
conversion work anyway.
thanks,
-- Shuah
>
> drivers/media/usb/au0828/au0828-video.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c
> index 94b65b8..17450eb 100644
> --- a/drivers/media/usb/au0828/au0828-video.c
> +++ b/drivers/media/usb/au0828/au0828-video.c
> @@ -1785,7 +1785,7 @@ int au0828_analog_register(struct au0828_dev *dev,
> dprintk(1, "unable to register video device (error = %d).\n",
> retval);
> ret = -ENODEV;
> - goto err_vbi_dev;
> + goto err_reg_vdev;
> }
>
> /* Register the vbi device */
> @@ -1795,14 +1795,18 @@ int au0828_analog_register(struct au0828_dev *dev,
> dprintk(1, "unable to register vbi device (error = %d).\n",
> retval);
> ret = -ENODEV;
> - goto err_vbi_dev;
> + goto err_reg_vbi_dev;
> }
>
> -
> dprintk(1, "%s completed!\n", __func__);
>
> return 0;
>
> +err_reg_vbi_dev:
> + video_unregister_device(dev->vdev);
> +err_reg_vdev:
> + vb2_queue_release(&dev->vb_vidq);
> + vb2_queue_release(&dev->vb_vbiq);
> err_vbi_dev:
> video_device_release(dev->vbi_dev);
> err_vdev:
>
--
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shuahkh@osg.samsung.com | (970) 217-8978
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-29 1:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-31 0:22 [PATCH] media: au0828 analog_register error path fixes to do proper cleanup Shuah Khan
2015-01-28 23:54 ` Shuah Khan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).