media: saa7146: fix error logic at saa7146_vv_init()
As the first thing this function does is to call v4l2_device_register(), it should call v4l2_device_unregister() if an error occurs, the same way as done at saa7146_vv_release(). Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
3af86b0469
commit
f4217069cd
@ -487,6 +487,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
|
|||||||
if (hdl->error) {
|
if (hdl->error) {
|
||||||
err = hdl->error;
|
err = hdl->error;
|
||||||
v4l2_ctrl_handler_free(hdl);
|
v4l2_ctrl_handler_free(hdl);
|
||||||
|
v4l2_device_unregister(&dev->v4l2_dev);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
dev->v4l2_dev.ctrl_handler = hdl;
|
dev->v4l2_dev.ctrl_handler = hdl;
|
||||||
@ -495,6 +496,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
|
|||||||
if (vv == NULL) {
|
if (vv == NULL) {
|
||||||
ERR("out of memory. aborting.\n");
|
ERR("out of memory. aborting.\n");
|
||||||
v4l2_ctrl_handler_free(hdl);
|
v4l2_ctrl_handler_free(hdl);
|
||||||
|
v4l2_device_unregister(&dev->v4l2_dev);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
ext_vv->vid_ops = saa7146_video_ioctl_ops;
|
ext_vv->vid_ops = saa7146_video_ioctl_ops;
|
||||||
@ -521,6 +523,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
|
|||||||
ERR("out of memory. aborting.\n");
|
ERR("out of memory. aborting.\n");
|
||||||
kfree(vv);
|
kfree(vv);
|
||||||
v4l2_ctrl_handler_free(hdl);
|
v4l2_ctrl_handler_free(hdl);
|
||||||
|
v4l2_device_unregister(&dev->v4l2_dev);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user