linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 2/2] spi: meson-spicc: fix a wrong goto jump for avoiding memory leak.
@ 2021-06-13  5:29 zpershuai
  2021-06-14 13:08 ` Neil Armstrong
  2021-06-14 19:53 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: zpershuai @ 2021-06-13  5:29 UTC (permalink / raw)
  To: Mark Brown, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, linux-spi, linux-arm-kernel, linux-amlogic,
	linux-kernel
  Cc: 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.

Signed-off-by: zpershuai <zpershuai@gmail.com>
---
 drivers/spi/spi-meson-spicc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c
index d675334..b2c4621 100644
--- a/drivers/spi/spi-meson-spicc.c
+++ b/drivers/spi/spi-meson-spicc.c
@@ -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);
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 2/2] spi: meson-spicc: fix a wrong goto jump for avoiding memory leak.
  2021-06-13  5:29 [PATCH v2 2/2] spi: meson-spicc: fix a wrong goto jump for avoiding memory leak zpershuai
@ 2021-06-14 13:08 ` Neil Armstrong
  2021-06-14 19:53 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Neil Armstrong @ 2021-06-14 13:08 UTC (permalink / raw)
  To: zpershuai, Mark Brown, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, linux-spi, linux-arm-kernel, linux-amlogic,
	linux-kernel

Hi,

On 13/06/2021 07:29, zpershuai wrote:
> 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>
> ---
>  drivers/spi/spi-meson-spicc.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c
> index d675334..b2c4621 100644
> --- a/drivers/spi/spi-meson-spicc.c
> +++ b/drivers/spi/spi-meson-spicc.c
> @@ -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);
>  
> 

Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 2/2] spi: meson-spicc: fix a wrong goto jump for avoiding memory leak.
  2021-06-13  5:29 [PATCH v2 2/2] spi: meson-spicc: fix a wrong goto jump for avoiding memory leak zpershuai
  2021-06-14 13:08 ` Neil Armstrong
@ 2021-06-14 19:53 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2021-06-14 19:53 UTC (permalink / raw)
  To: Jerome Brunet, linux-amlogic, linux-kernel, Neil Armstrong,
	linux-spi, Martin Blumenstingl, Kevin Hilman, zpershuai,
	linux-arm-kernel
  Cc: Mark Brown

On Sun, 13 Jun 2021 13:29:32 +0800, zpershuai wrote:
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-14 19:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-13  5:29 [PATCH v2 2/2] spi: meson-spicc: fix a wrong goto jump for avoiding memory leak zpershuai
2021-06-14 13:08 ` Neil Armstrong
2021-06-14 19:53 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).