Skip to content

Commit

Permalink
spi: meson-spicc: fix a wrong goto jump for avoiding memory leak.
Browse files Browse the repository at this point in the history
[ Upstream commit 95730d5 ]

In meson_spifc_probe function, when enable the device pclk clock is
error, it should use clk_disable_unprepare to release the core clock.

Signed-off-by: zpershuai <zpershuai@gmail.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://lore.kernel.org/r/1623562172-22056-1-git-send-email-zpershuai@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
zpershuai authored and gregkh committed Jul 14, 2021
1 parent ea7e1b5 commit a0bbb5d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/spi/spi-meson-spicc.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ static int meson_spicc_probe(struct platform_device *pdev)
ret = clk_prepare_enable(spicc->pclk);
if (ret) {
dev_err(&pdev->dev, "pclk clock enable failed\n");
goto out_master;
goto out_core_clk;
}

device_reset_optional(&pdev->dev);
Expand Down Expand Up @@ -764,9 +764,11 @@ static int meson_spicc_probe(struct platform_device *pdev)
return 0;

out_clk:
clk_disable_unprepare(spicc->core);
clk_disable_unprepare(spicc->pclk);

out_core_clk:
clk_disable_unprepare(spicc->core);

out_master:
spi_master_put(master);

Expand Down

0 comments on commit a0bbb5d

Please sign in to comment.