mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 18:09:56 +00:00
media: saa7146: add cleanup in hexium_attach()
[ Upstream commit 42e64117d3 ]
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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
21f618b96d
commit
be5ca71813
@@ -292,6 +292,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);
|
ret = saa7146_register_device(&hexium->video_dev, dev, "hexium gemini", VFL_TYPE_GRABBER);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
pr_err("cannot register capture v4l2 device. skipping.\n");
|
pr_err("cannot register capture v4l2 device. skipping.\n");
|
||||||
|
saa7146_vv_release(dev);
|
||||||
|
i2c_del_adapter(&hexium->i2c_adapter);
|
||||||
|
kfree(hexium);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user