Skip to content

Commit

Permalink
mtd: rawnand: meson: Fix a resource leak in init
Browse files Browse the repository at this point in the history
[ Upstream commit ad8566d ]

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

Fixes: 8fae856 ("mtd: rawnand: meson: add support for Amlogic NAND flash controller")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/X8ikVCnUsfTpffFB@mwanda
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Dan Carpenter authored and gregkh committed Dec 30, 2020
1 parent a50f5a6 commit 03c9406
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/mtd/nand/raw/meson_nand.c
Expand Up @@ -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:
Expand Down

0 comments on commit 03c9406

Please sign in to comment.