Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1730449 > unrolled thread

[PATCH V2] media: v4l2-pci-skeleton: Fix error handling path in 'skeleton_probe()'

Started byChristophe JAILLET <christophe.jaillet@wanadoo.fr>
First post2017-09-11 19:00 +0200
Last post2017-09-11 19:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH V2] media: v4l2-pci-skeleton: Fix error handling path in 'skeleton_probe()' Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-09-11 19:00 +0200

#1730449 — [PATCH V2] media: v4l2-pci-skeleton: Fix error handling path in 'skeleton_probe()'

FromChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Date2017-09-11 19:00 +0200
Subject[PATCH V2] media: v4l2-pci-skeleton: Fix error handling path in 'skeleton_probe()'
Message-ID<uoAdX-5Xi-1@gated-at.bofh.it>
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>
---
v2: linux-media@vger.kernel.org added in cc
---
 samples/v4l/v4l2-pci-skeleton.c | 6 ++++--
 1 file 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,
-- 
2.11.0

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web