kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: rawnand: meson: Fix a resource leak in init
@ 2020-12-03  8:39 Dan Carpenter
  2020-12-07 11:09 ` Miquel Raynal
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-12-03  8:39 UTC (permalink / raw)
  To: Liang Yang
  Cc: kernel-janitors, Vignesh Raghavendra, Jianxin Pan,
	Neil Armstrong, Martin Blumenstingl, Richard Weinberger,
	Miquel Raynal, Yixun Lan, linux-mtd, Kevin Hilman, linux-amlogic,
	Jerome Brunet

Call clk_disable_unprepare(nfc->phase_rx) if the clk_set_rate() function
fails to avoid a resource leak.

Fixes: 8fae856c5350 ("mtd: rawnand: meson: add support for Amlogic NAND flash controller")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/mtd/nand/raw/meson_nand.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
index a76afea6ea77..817bddccb775 100644
--- a/drivers/mtd/nand/raw/meson_nand.c
+++ b/drivers/mtd/nand/raw/meson_nand.c
@@ -1044,9 +1044,12 @@ static int meson_nfc_clk_init(struct meson_nfc *nfc)
 
 	ret = clk_set_rate(nfc->device_clk, 24000000);
 	if (ret)
-		goto err_phase_rx;
+		goto err_disable_rx;
 
 	return 0;
+
+err_disable_rx:
+	clk_disable_unprepare(nfc->phase_rx);
 err_phase_rx:
 	clk_disable_unprepare(nfc->phase_tx);
 err_phase_tx:
-- 
2.29.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mtd: rawnand: meson: Fix a resource leak in init
  2020-12-03  8:39 [PATCH] mtd: rawnand: meson: Fix a resource leak in init Dan Carpenter
@ 2020-12-07 11:09 ` Miquel Raynal
  0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2020-12-07 11:09 UTC (permalink / raw)
  To: Dan Carpenter, Liang Yang
  Cc: Yixun Lan, Vignesh Raghavendra, Jianxin Pan, Neil Armstrong,
	Martin Blumenstingl, Richard Weinberger, kernel-janitors,
	linux-mtd, Kevin Hilman, Miquel Raynal, linux-amlogic,
	Jerome Brunet

On Thu, 2020-12-03 at 08:39:48 UTC, Dan Carpenter wrote:
> Call clk_disable_unprepare(nfc->phase_rx) if the clk_set_rate() function
> fails to avoid a resource leak.
> 
> Fixes: 8fae856c5350 ("mtd: rawnand: meson: add support for Amlogic NAND flash controller")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-07 11:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03  8:39 [PATCH] mtd: rawnand: meson: Fix a resource leak in init Dan Carpenter
2020-12-07 11:09 ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).