Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753091AbdLHVQB (ORCPT ); Fri, 8 Dec 2017 16:16:01 -0500 Received: from smtp05.smtpout.orange.fr ([80.12.242.127]:44748 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752546AbdLHVQA (ORCPT ); Fri, 8 Dec 2017 16:16:00 -0500 X-ME-Helo: [192.168.1.12] X-ME-Date: Fri, 08 Dec 2017 22:15:59 +0100 X-ME-IP: 86.236.211.195 Subject: Re: [PATCH] mtd: onenand: Fix an error handling path in 's3c_onenand_probe(()' To: Boris Brezillon 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 Newsgroups: gmane.linux.kernel,gmane.linux.drivers.mtd,gmane.linux.kernel.janitors References: <20171118132723.24785-1-christophe.jaillet@wanadoo.fr> <20171207175552.4825e642@bbrezillon> From: Christophe JAILLET Message-ID: <50688cb3-ae7a-5a15-4989-9933593ff11d@wanadoo.fr> Date: Fri, 8 Dec 2017 22:15:58 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20171207175552.4825e642@bbrezillon> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: fr Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1430 Lines: 39 Le 07/12/2017 à 17:55, Boris Brezillon a écrit : > 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. Thanks for your comment. devm_ functions greatly simplify the code. I've proposed an update for that. If I'm correct, this also helped to find two other bugs (un-balanced request_irq() and un-handled error code) CJ