Skip to content

Commit

Permalink
[media] media: v4l2-pci-skeleton: Fix error handling path in 'skeleto…
Browse files Browse the repository at this point in the history
…n_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 <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
tititiou36 authored and mchehab committed Oct 4, 2017
1 parent a8c779e commit 15a35ca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions samples/v4l/v4l2-pci-skeleton.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 15a35ca

Please sign in to comment.