Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Christophe JAILLET and committed by
Mauro Carvalho Chehab
15a35ca6 a8c779eb

+4 -2
+4 -2
samples/v4l/v4l2-pci-skeleton.c
··· 772 772 773 773 /* Allocate a new instance */ 774 774 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 + } 777 779 778 780 /* Allocate the interrupt */ 779 781 ret = devm_request_irq(&pdev->dev, pdev->irq,