From: Dan Carpenter Date: Thu, 3 Dec 2020 08:39:48 +0000 (+0300) Subject: mtd: rawnand: meson: Fix a resource leak in init X-Git-Tag: accepted/tizen/unified/20230118.172025~8250^2^3~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ad8566d3555c4731e6b48823b92d3929b0394c14;p=platform%2Fkernel%2Flinux-rpi.git mtd: rawnand: meson: Fix a resource leak in init 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 Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/X8ikVCnUsfTpffFB@mwanda --- diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c index a76afea..817bddc 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: