diff options
author | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2021-12-14 16:52:28 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2021-12-14 17:09:14 +0300 |
commit | f4217069cd11635bf397ca1b6488ceb8c7bc66ab (patch) | |
tree | 08fb0cb41fb71b1addbf70a5b00a1eadeaaa7692 /drivers/media/common | |
parent | 3af86b046933ba513d08399dba0d4d8b50d607d0 (diff) | |
download | linux-f4217069cd11635bf397ca1b6488ceb8c7bc66ab.tar.xz |
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>
Diffstat (limited to 'drivers/media/common')
-rw-r--r-- | drivers/media/common/saa7146/saa7146_fops.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/media/common/saa7146/saa7146_fops.c b/drivers/media/common/saa7146/saa7146_fops.c index be3215977714..e9a15de6126e 100644 --- a/drivers/media/common/saa7146/saa7146_fops.c +++ b/drivers/media/common/saa7146/saa7146_fops.c @@ -487,6 +487,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) if (hdl->error) { err = hdl->error; v4l2_ctrl_handler_free(hdl); + v4l2_device_unregister(&dev->v4l2_dev); return err; } 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) { ERR("out of memory. aborting.\n"); v4l2_ctrl_handler_free(hdl); + v4l2_device_unregister(&dev->v4l2_dev); return -ENOMEM; } 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"); kfree(vv); v4l2_ctrl_handler_free(hdl); + v4l2_device_unregister(&dev->v4l2_dev); return -ENOMEM; } |