mtd: rawnand: meson: Fix a resource leak in init
Subsystems (5)
Kernel janitors Memory technology devices (MTD) Arm/Amlogic Meson SoC support NAND flash +1 more subsystems
PATCH 1/1 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 <[email protected]>
--- drivers/mtd/nand/raw/meson_nand.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/mtd/nand/raw/meson_nand.c +4 -1
@@ -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:
Signature · 1 line
2.29.2
Quoted 5 lines · Dan Carpenter
Call
clk_disable_unprepare(nfc->phase_rx)if theclk_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 <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel