Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751798AbdISUNa (ORCPT ); Tue, 19 Sep 2017 16:13:30 -0400 Received: from mail.free-electrons.com ([62.4.15.54]:51592 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751396AbdISUN2 (ORCPT ); Tue, 19 Sep 2017 16:13:28 -0400 Date: Tue, 19 Sep 2017 22:13:15 +0200 From: Boris Brezillon To: Christophe JAILLET Cc: richard@nod.at, dwmw2@infradead.org, computersforpeace@gmail.com, marek.vasut@gmail.com, cyrille.pitchen@wedev4u.fr, vz@mleia.com, slemieux.tyco@gmail.com, kernel-janitors@vger.kernel.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] mtd: nand: lpc32xx_mlc: Fix an error handling path in lpc32xx_nand_probe() Message-ID: <20170919221315.11d94426@bbrezillon> In-Reply-To: <20170903115831.1326-1-christophe.jaillet@wanadoo.fr> References: <20170903115831.1326-1-christophe.jaillet@wanadoo.fr> 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: 1313 Lines: 42 On Sun, 3 Sep 2017 13:58:31 +0200 Christophe JAILLET wrote: > If 'clk_prepare_enable()' fails, we must 'put' the corresponding clock. > > Fixes: 4d26f012ab59 ("mtd: nand: lpc32xx_mlc: Handle return value of clk_prepare_enable.") > Signed-off-by: Christophe JAILLET Applied. Thanks, Boris > --- > Labels in the error handling path could be renamed, but it does not worth > the effort, IMHO. > --- > drivers/mtd/nand/lpc32xx_mlc.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/mtd/nand/lpc32xx_mlc.c b/drivers/mtd/nand/lpc32xx_mlc.c > index c3bb358ef01e..5f72a824e67d 100644 > --- a/drivers/mtd/nand/lpc32xx_mlc.c > +++ b/drivers/mtd/nand/lpc32xx_mlc.c > @@ -707,7 +707,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) > } > res = clk_prepare_enable(host->clk); > if (res) > - goto err_exit1; > + goto err_put_clk; > > nand_chip->cmd_ctrl = lpc32xx_nand_cmd_ctrl; > nand_chip->dev_ready = lpc32xx_nand_device_ready; > @@ -814,6 +814,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) > dma_release_channel(host->dma_chan); > err_exit2: > clk_disable_unprepare(host->clk); > +err_put_clk: > clk_put(host->clk); > err_exit1: > lpc32xx_wp_enable(host);