diff options
author | Wenwen Wang <wenwen@cs.uga.edu> | 2019-08-18 02:40:14 -0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-10-05 13:09:49 +0200 |
commit | d796c6c1aab46800434ca71307428f16c39174c8 (patch) | |
tree | c111783da231fac5e04d7d5ab0ede1900178364d /drivers/media | |
parent | ab20f38ce52212298cc151bb2a835ce4092f5a6a (diff) | |
download | linux-stable-d796c6c1aab46800434ca71307428f16c39174c8.tar.gz linux-stable-d796c6c1aab46800434ca71307428f16c39174c8.tar.bz2 linux-stable-d796c6c1aab46800434ca71307428f16c39174c8.zip |
media: saa7146: add cleanup in hexium_attach()
[ Upstream commit 42e64117d3b4a759013f77bbcf25ab6700e55de7 ]
If saa7146_register_device() fails, no cleanup is executed, leading to
memory/resource leaks. To fix this issue, perform necessary cleanup work
before returning the error.
Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/pci/saa7146/hexium_gemini.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/media/pci/saa7146/hexium_gemini.c b/drivers/media/pci/saa7146/hexium_gemini.c index 6d8e4afe9673..8c56d4c37a52 100644 --- a/drivers/media/pci/saa7146/hexium_gemini.c +++ b/drivers/media/pci/saa7146/hexium_gemini.c @@ -304,6 +304,9 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d ret = saa7146_register_device(&hexium->video_dev, dev, "hexium gemini", VFL_TYPE_GRABBER); if (ret < 0) { pr_err("cannot register capture v4l2 device. skipping.\n"); + saa7146_vv_release(dev); + i2c_del_adapter(&hexium->i2c_adapter); + kfree(hexium); return ret; } |