Skip to content

Commit 15a35ca

Browse files
tititiou36mchehab
authored andcommitted
[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>
1 parent a8c779e commit 15a35ca

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎samples/v4l/v4l2-pci-skeleton.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -772,8 +772,10 @@ static int skeleton_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
772772

773773
/* Allocate a new instance */
774774
skel = devm_kzalloc(&pdev->dev, sizeof(struct skeleton), GFP_KERNEL);
775-
if (!skel)
776-
return -ENOMEM;
775+
if (!skel) {
776+
ret = -ENOMEM;
777+
goto disable_pci;
778+
}
777779

778780
/* Allocate the interrupt */
779781
ret = devm_request_irq(&pdev->dev, pdev->irq,

0 commit comments

Comments
 (0)