Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755163AbdLGQ4A (ORCPT ); Thu, 7 Dec 2017 11:56:00 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:41419 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755141AbdLGQzy (ORCPT ); Thu, 7 Dec 2017 11:55:54 -0500 Date: Thu, 7 Dec 2017 17:55:52 +0100 From: Boris Brezillon To: Christophe JAILLET Cc: kyungmin.park@samsung.com, dwmw2@infradead.org, computersforpeace@gmail.com, marek.vasut@gmail.com, richard@nod.at, cyrille.pitchen@wedev4u.fr, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] mtd: onenand: Fix an error handling path in 's3c_onenand_probe(()' Message-ID: <20171207175552.4825e642@bbrezillon> In-Reply-To: <20171118132723.24785-1-christophe.jaillet@wanadoo.fr> References: <20171118132723.24785-1-christophe.jaillet@wanadoo.fr> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1194 Lines: 33 On Sat, 18 Nov 2017 14:27:23 +0100 Christophe JAILLET wrote: > If 'platform_get_resource()' fails, we have to go through the error > handling path to release some resources. > > The unreachable 'goto ahb_resource_failed' is also wrong here and we should > go to 'resource_failed' instead. > > Signed-off-by: Christophe JAILLET > --- > drivers/mtd/onenand/samsung.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c > index af0ac1a7bf8f..164ebe2b1137 100644 > --- a/drivers/mtd/onenand/samsung.c > +++ b/drivers/mtd/onenand/samsung.c > @@ -872,8 +872,8 @@ static int s3c_onenand_probe(struct platform_device *pdev) > r = platform_get_resource(pdev, IORESOURCE_MEM, 0); > if (!r) { > dev_err(&pdev->dev, "no memory resource defined\n"); > - return -ENOENT; > - goto ahb_resource_failed; > + err = -ENOENT; > + goto resource_failed; > } > Sorry but I'd really prefer to convert the driver to use devm_ functions instead of fixing a single error path. > onenand->base_res = request_mem_region(r->start, resource_size(r),