Skip to content

Commit

Permalink
media: saa7146: add cleanup in hexium_attach()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
wenwenwang1 authored and mchehab committed Aug 26, 2019
1 parent 725a282 commit 42e6411
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/media/pci/saa7146/hexium_gemini.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
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;
}

Expand Down

0 comments on commit 42e6411

Please sign in to comment.