summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2017-09-11 13:53:07 -0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2017-10-04 16:55:02 -0300
commit15a35ca66aaff3386f174cfd3daa4713976e6edc (patch)
tree26d66baf441e6d1cb03ae24987402df252fd8907 /samples
parenta8c779eb056e9874c6278151ade857c3ac227db9 (diff)
downloadlwn-15a35ca66aaff3386f174cfd3daa4713976e6edc.tar.gz
lwn-15a35ca66aaff3386f174cfd3daa4713976e6edc.zip
[media] media: v4l2-pci-skeleton: Fix error handling path in 'skeleton_probe()'
If this memory allocation fails, we must release some resources, as already done in the code below and above. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'samples')
-rw-r--r--samples/v4l/v4l2-pci-skeleton.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/samples/v4l/v4l2-pci-skeleton.c b/samples/v4l/v4l2-pci-skeleton.c
index 483e9bca9444..f520e3aef9c6 100644
--- a/samples/v4l/v4l2-pci-skeleton.c
+++ b/samples/v4l/v4l2-pci-skeleton.c
@@ -772,8 +772,10 @@ static int skeleton_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
/* Allocate a new instance */
skel = devm_kzalloc(&pdev->dev, sizeof(struct skeleton), GFP_KERNEL);
- if (!skel)
- return -ENOMEM;
+ if (!skel) {
+ ret = -ENOMEM;
+ goto disable_pci;
+ }
/* Allocate the interrupt */
ret = devm_request_irq(&pdev->dev, pdev->irq,