Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750795AbdLNGLS (ORCPT ); Thu, 14 Dec 2017 01:11:18 -0500 Received: from smtp06.smtpout.orange.fr ([80.12.242.128]:26867 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750819AbdLNGKL (ORCPT ); Thu, 14 Dec 2017 01:10:11 -0500 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 14 Dec 2017 07:10:10 +0100 X-ME-IP: 86.236.211.195 From: Christophe JAILLET To: kyungmin.park@samsung.com, dwmw2@infradead.org, computersforpeace@gmail.com, boris.brezillon@free-electrons.com, marek.vasut@gmail.com, richard@nod.at, cyrille.pitchen@wedev4u.fr Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH 2/4 v3] mtd: onenand: samsung: return an error if 'mtd_device_parse_register()' fails Date: Thu, 14 Dec 2017 07:03:50 +0100 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 982 Lines: 33 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 --- Cross-compiled tested-only v2: call 'onenand_release()' to undo 'onenand_scan()' v3: no change --- drivers/mtd/onenand/samsung.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c index b650290611d2..b5497c5a35f1 100644 --- a/drivers/mtd/onenand/samsung.c +++ b/drivers/mtd/onenand/samsung.c @@ -936,6 +936,11 @@ 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"); + onenand_release(mtd); + return err; + } platform_set_drvdata(pdev, mtd); -- 2.14.1