From patchwork Tue Jul 23 12:28:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 261062 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from casper.infradead.org (unknown [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 45F682C0097 for ; Tue, 23 Jul 2013 22:30:36 +1000 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V1biV-0004ED-9h; Tue, 23 Jul 2013 12:29:24 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V1biC-0000V1-0K; Tue, 23 Jul 2013 12:29:04 +0000 Received: from smtp39.i.mail.ru ([94.100.177.99]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V1bi8-0000Rj-Nz for linux-mtd@lists.infradead.org; Tue, 23 Jul 2013 12:29:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=kZVFK2V7FUZLvWthkRBJ7xLPrTkE/kYYXXy55+2wYaE=; b=idCUUtLJOVOimG6P5vg1cbQrzUwIWv2DHFdIlDnYxdiagnPDZI3FvkpnpTx3ExG27UOkcyI6elZrHcUg+Mb3ghIhMpiLCrfKyIN/udK3ym0V/wI6Y7gic2YVZebpzJhDudglRtlOjusXxzL7uHcLxLxpUkLPfpuN7AKcYoAakn8=; Received: from [217.119.30.118] (port=24069 helo=shc.milas.spb.ru) by smtp39.i.mail.ru with esmtpa (envelope-from ) id 1V1bhn-0004EP-LM; Tue, 23 Jul 2013 16:28:39 +0400 From: Alexander Shiyan To: linux-mtd@lists.infradead.org Subject: [PATCH 3/4] mtd: nand: gpio: Return real nand_scan() error code on fail and simplify error path Date: Tue, 23 Jul 2013 16:28:18 +0400 Message-Id: <1374582499-31823-3-git-send-email-shc_work@mail.ru> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1374582499-31823-1-git-send-email-shc_work@mail.ru> References: <1374582499-31823-1-git-send-email-shc_work@mail.ru> X-Spam: Not detected X-Mras: Ok X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130723_082901_439388_DBACF988 X-CRM114-Status: GOOD ( 11.04 ) X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.8 RCVD_IN_SORBS_WEB RBL: SORBS: sender is an abusable web server [217.119.30.118 listed in dnsbl.sorbs.net] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (shc_work[at]mail.ru) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Artem Bityutskiy , Brian Norris , David Woodhouse , Alexander Shiyan X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: Alexander Shiyan --- drivers/mtd/nand/gpio.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/drivers/mtd/nand/gpio.c b/drivers/mtd/nand/gpio.c index 7f16962..7b1dbd3 100644 --- a/drivers/mtd/nand/gpio.c +++ b/drivers/mtd/nand/gpio.c @@ -206,7 +206,7 @@ static int gpio_nand_probe(struct platform_device *pdev) struct nand_chip *chip; struct resource *res; struct mtd_part_parser_data ppdata = {}; - int ret = 0; + int ret; if (!pdev->dev.of_node && !pdev->dev.platform_data) return -EINVAL; @@ -282,23 +282,20 @@ static int gpio_nand_probe(struct platform_device *pdev) gpio_nand_set_wp(gpiomtd, 1); - if (nand_scan(&gpiomtd->mtd_info, 1)) { - ret = -ENXIO; - goto err_wp; + ret = nand_scan(&gpiomtd->mtd_info, 1); + if (!ret) { + if (gpiomtd->plat.adjust_parts) + gpiomtd->plat.adjust_parts(&gpiomtd->plat, + gpiomtd->mtd_info.size); + + ppdata.of_node = pdev->dev.of_node; + ret = mtd_device_parse_register(&gpiomtd->mtd_info, NULL, + &ppdata, gpiomtd->plat.parts, + gpiomtd->plat.num_parts); + if (!ret) + return 0; } - if (gpiomtd->plat.adjust_parts) - gpiomtd->plat.adjust_parts(&gpiomtd->plat, - gpiomtd->mtd_info.size); - - ppdata.of_node = pdev->dev.of_node; - ret = mtd_device_parse_register(&gpiomtd->mtd_info, NULL, &ppdata, - gpiomtd->plat.parts, - gpiomtd->plat.num_parts); - if (!ret) - return 0; - -err_wp: gpio_nand_set_wp(gpiomtd, 0); return ret;