[PATCH] soc-camera: fix missing clean up on error path
Guennadi Liakhovetski <[email protected]>
| Newsgroups | gmane.comp.video.video4linux |
|---|---|
| Message-ID | <[email protected]> |
If soc_camera_init_user_formats() fails in soc_camera_probe(), we have to call client's .remove() method to unregister the video device. Reported-by: Kuninori Morimoto <[email protected]> Signed-off-by: Guennadi Liakhovetski <[email protected]> --- Hi Morimoto-san On Tue, 9 Jun 2009, Kuninori Morimoto wrote: > > > soc_camera_open use icd->current_fmt directly. > > > It doesn't check if icd->current_fmt != NULL. > > > > Which kernel version, resp., version of the soc-camera stack are you > > using? What you describe would be a bug, but it shouldn't be present > > neither in the soc-camera stack, converted to v4l2-subdev (see my last > > series of 10 patches), nor in a partially converted stack. > > I use latest Paul's (for SH) git > > > is present in the current mainline. There's a call to > > > > if (icd->ops->remove) > > icd->ops->remove(icd); > > > > missing on the "goto eiufmt;" error path. You'd just have to insert the > > above call before the goto. Would you like to prepare a patch? > > wow... > why can I call soc_camera_open even if soc_camera_probe failed ? Could you please verify that this patch fixed your problem? drivers/media/video/soc_camera.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index 78010ab..6dc3d11 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c @@ -877,8 +877,11 @@ static int soc_camera_probe(struct device *dev) (unsigned short)~0; ret = soc_camera_init_user_formats(icd); - if (ret < 0) + if (ret < 0) { + if (icd->ops->remove) + icd->ops->remove(icd); goto eiufmt; + } icd->height = DEFAULT_HEIGHT; icd->width = DEFAULT_WIDTH; -- 1.6.2.4 -- video4linux-list mailing list Unsubscribe mailto:[email protected]?subject=unsubscribe https://www.redhat.com/mailman/listinfo/video4linux-list