From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750986AbdIKHVj (ORCPT ); Mon, 11 Sep 2017 03:21:39 -0400 Received: from aer-iport-2.cisco.com ([173.38.203.52]:42299 "EHLO aer-iport-2.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750789AbdIKHVi (ORCPT ); Mon, 11 Sep 2017 03:21:38 -0400 X-IronPort-AV: E=Sophos;i="5.42,376,1500940800"; d="scan'208";a="654527151" Subject: Re: [PATCH] media: v4l2-pci-skeleton: Fix error handling path in 'skeleton_probe()' To: Christophe JAILLET , mchehab@kernel.org, hans.verkuil@cisco.com, Julia.Lawall@lip6.fr Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org References: <20170910115322.15482-1-christophe.jaillet@wanadoo.fr> From: Hans Verkuil Message-ID: <9b00047e-ce61-bd72-9bf2-c248a87eb013@cisco.com> Date: Mon, 11 Sep 2017 09:21:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170910115322.15482-1-christophe.jaillet@wanadoo.fr> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-User: hansverk Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/10/2017 01:53 PM, Christophe JAILLET wrote: > If this memory allocation fails, we must release some resources, as > already done in the code below and above. > > Signed-off-by: Christophe JAILLET Please repost and add the linux-media mailinglist to the CC list. That way it ends up in our patchwork system and it won't be forgotten. Regards, Hans > --- > 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, >