From patchwork Fri Mar 2 17:03:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 10255307 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 211A76037F for ; Fri, 2 Mar 2018 17:45:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0383427D0E for ; Fri, 2 Mar 2018 17:45:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA1A627D4D; Fri, 2 Mar 2018 17:45:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8321A27D0E for ; Fri, 2 Mar 2018 17:45:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=lSTAYHiPt8Lc86R6uZg9mB0KpwvSUTqxg16dN8XW3/M=; b=pjnTAJQH4j8rqM2lK1ieOcQ+iq FJF1UXZrm+LDwSyKwPhFiTei7HHA+1pbBeSULDQHyaEBxjFYg2jBL+eG5D2+9H1LdPd/FZpJq5lW/ mggPbUleaxTviR6aGYMKMI6yMVRJjZV5/fayP8L5Q7ZP8wnWoQSjFKDHESCiZrdwm0qG/+7p4NTaV CzCCPa6zai6n1fEEiHwyUGKTJ7KUKWraAuaWRutbnFU/0a4D/kiYEeC5uQ1ZUPXSKm/N308oYs1z0 UgMzADI878GP4AC1DcmYWe8emmU1JpjJ8Dmooq23dQtMyyKTGa4CFAc9XnY6uGJcjIn+zOoQKYqsE e30vVfDQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eroju-0004w7-M3; Fri, 02 Mar 2018 17:45:02 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eroAH-0005sL-DQ; Fri, 02 Mar 2018 17:08:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=b98xhXkabivGOV0HQPQukK+FobXmC1Pr9oH4oxcEfUE=; b=SNr3O17gsDViR+N7m76rkioqs dBmukvx400Oh1S4KahJeQ19jSAWDNu0rpzfWa35ikyQEBPjtUmMMHOUu80kJjeiNLehkqizBk1CLd QI36JxWYsr6KpN9H5+tWOV+RrBuT3T8ti0g3HrD3BHXApCGqDgKoGLRVamaqet64Mtj/6UT9M3rPD s41jyUhSc6YkiHz1A9YLb/LA6alG2PP6j10GkdF4VhfiKmMY66IkN7KyH74eL5XjhDDF8hTN4pHc+ jfmS6e7qW1/LM3NQvNHdnNI5ylw+7gZOBK4tFN313nfBtnWwSNC2++TOMYWKCkqakL8qkOAcOGJ2F Pfg6i+Qig==; Received: from mail.bootlin.com ([62.4.15.54]) by casper.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ero70-0005rb-Fg; Fri, 02 Mar 2018 17:04:58 +0000 Received: by mail.bootlin.com (Postfix, from userid 110) id 6976C209CA; Fri, 2 Mar 2018 18:04:27 +0100 (CET) Received: from localhost.localdomain (unknown [91.224.148.103]) by mail.bootlin.com (Postfix) with ESMTPSA id 8F815207EF; Fri, 2 Mar 2018 18:04:26 +0100 (CET) From: Miquel Raynal To: Boris Brezillon , Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Cyrille Pitchen , Josh Wu , Kamal Dasu , Harvey Hunt , Stefan Agner Subject: [PATCH 24/52] mtd: rawnand: lpc32xx_slc: enhance the probe function error Date: Fri, 2 Mar 2018 18:03:32 +0100 Message-Id: <20180302170400.6712-25-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180302170400.6712-1-miquel.raynal@bootlin.com> References: <20180302170400.6712-1-miquel.raynal@bootlin.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180302_170450_613185_78B5EA44 X-CRM114-Status: GOOD ( 16.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Miquel Raynal MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Prepare the migration of the lpc32xx_slc driver to use nand_scan() by cleaning the error path in the probe function. Signed-off-by: Miquel Raynal --- drivers/mtd/nand/raw/lpc32xx_slc.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/mtd/nand/raw/lpc32xx_slc.c b/drivers/mtd/nand/raw/lpc32xx_slc.c index 5f7cc6da0a7f..342f666ad435 100644 --- a/drivers/mtd/nand/raw/lpc32xx_slc.c +++ b/drivers/mtd/nand/raw/lpc32xx_slc.c @@ -831,11 +831,11 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) if (IS_ERR(host->clk)) { dev_err(&pdev->dev, "Clock failure\n"); res = -ENOENT; - goto err_exit1; + goto release_gpio; } res = clk_prepare_enable(host->clk); if (res) - goto err_exit1; + goto release_gpio; /* Set NAND IO addresses and command/ready functions */ chip->IO_ADDR_R = SLC_DATA(host->io_base); @@ -874,19 +874,19 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) GFP_KERNEL); if (host->data_buf == NULL) { res = -ENOMEM; - goto err_exit2; + goto release_clk; } res = lpc32xx_nand_dma_setup(host); if (res) { res = -EIO; - goto err_exit2; + goto release_clk; } /* Find NAND device */ res = nand_scan_ident(mtd, 1, NULL); if (res) - goto err_exit3; + goto release_dma; /* OOB and ECC CPU and DMA work areas */ host->ecc_buf = (uint32_t *)(host->data_buf + LPC32XX_DMA_DATA_SIZE); @@ -920,21 +920,23 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) */ res = nand_scan_tail(mtd); if (res) - goto err_exit3; + goto release_dma; mtd->name = "nxp_lpc3220_slc"; res = mtd_device_register(mtd, host->ncfg->parts, host->ncfg->num_parts); - if (!res) - return res; + if (res) + goto release_nand; + return 0; + +release_nand: nand_release(mtd); - -err_exit3: +release_dma: dma_release_channel(host->dma_chan); -err_exit2: +release_clk: clk_disable_unprepare(host->clk); -err_exit1: +release_gpio: lpc32xx_wp_enable(host); return res;