Skip to contentSkip to conversation

spi: meson-spicc: fix a wrong goto jump for avoiding memory leak.

PATCH In review zpershuai 3 participants 3 messages Jun 13, 2021 – Jun 14, 2021

Subsystems (2)
lore
Share & tools
lore

zpershuai

author
#0 lore raw

PATCH v2 2/2 spi: meson-spicc: fix a wrong goto jump for avoiding memory leak.

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

---
 drivers/spi/spi-meson-spicc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/spi/spi-meson-spicc.c +4 -2
index d675334..b2c4621 100644
@@ -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);
@@ -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);
 
Signature · 1 line
2.7.4
Reviewed-by on v2 2/2
#1 lore raw

Hi,

Quoted 25 lines · zpershuai

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

---
 drivers/spi/spi-meson-spicc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/spi/spi-meson-spicc.c +1 -1
index d675334..b2c4621 100644
@@ -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);
@@ -764,9 +764,11 @@ static int meson_spicc_probe(struct platform_device *pdev)
 	return 0;
 

drivers/spi/spi-meson-spicc.c static int meson_spicc_probe(struct platform_device *pdev) · line 774

Quoted 10 lines
drivers/spi/spi-meson-spicc.c +3 -1
 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);
 
maintainer
#2 lore raw
In reply to zpershuai
Quoted 2 lines · zpershuai

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

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[2/2] spi: meson-spicc: fix a wrong goto jump for avoiding memory leak.

      commit: 95730d5eb73170a6d225a9998c478be273598634

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark