Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753049AbdLHVYr (ORCPT ); Fri, 8 Dec 2017 16:24:47 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:51542 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752289AbdLHVYq (ORCPT ); Fri, 8 Dec 2017 16:24:46 -0500 Date: Fri, 8 Dec 2017 22:24:34 +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 2/2] mtd: onenand: samsung: return an error if 'mtd_device_parse_register()' fails Message-ID: <20171208222434.4f146e12@bbrezillon> In-Reply-To: References: 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: 1117 Lines: 34 On Fri, 8 Dec 2017 22:11:05 +0100 Christophe JAILLET wrote: > If 'mtd_device_parse_register()' fails, we still return 0 which mean > success. > Return the error code instead, as done in all the other error handling > paths. > > Signed-off-by: Christophe JAILLET > --- > Compile tested-only > --- > drivers/mtd/onenand/samsung.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c > index 04039b967d59..5410e654d3cf 100644 > --- a/drivers/mtd/onenand/samsung.c > +++ b/drivers/mtd/onenand/samsung.c > @@ -987,6 +987,10 @@ static int s3c_onenand_probe(struct platform_device *pdev) > err = mtd_device_parse_register(mtd, NULL, NULL, > pdata ? pdata->parts : NULL, > pdata ? pdata->nr_parts : 0); > + if (err) { > + dev_err(&pdev->dev, "failed to parse partitions and register the MTD device\n"); And you should call onenand_release() here, to release the resources allocated in onenand_scan(). > + return err; > + } > > platform_set_drvdata(pdev, mtd); >