ARM Sunxi Platform Development
 help / color / mirror / Atom feed
* [PATCH 1/2] spi: sun6i: Fix memory leak on device removal
       [not found] <20231002062957.1741396-1-woodylab@foxmail.com>
@ 2023-10-02  6:29 ` Woody Zhang
       [not found] ` <tencent_E465261B2BB2C1EBAF5C19912B9F19B7E107@qq.com>
  1 sibling, 0 replies; 2+ messages in thread
From: Woody Zhang @ 2023-10-02  6:29 UTC (permalink / raw)
  To: Mark Brown, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
  Cc: linux-spi, linux-arm-kernel, linux-sunxi, linux-kernel,
	Woody Zhang

Call spi_master_put to free the spi_master structure on device removal
and driver detachment.

Signed-off-by: Woody Zhang <woodylab@foxmail.com>
---
 drivers/spi/spi-sun6i.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c
index fddc63309773..33cec49d5538 100644
--- a/drivers/spi/spi-sun6i.c
+++ b/drivers/spi/spi-sun6i.c
@@ -774,6 +774,7 @@ static void sun6i_spi_remove(struct platform_device *pdev)
 		dma_release_channel(master->dma_tx);
 	if (master->dma_rx)
 		dma_release_channel(master->dma_rx);
+	spi_master_put(master);
 }
 
 static const struct sun6i_spi_cfg sun6i_a31_spi_cfg = {
-- 
2.39.2


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

* Re: [PATCH 2/2] spi: sun4i: Fix memory leak on device removal
       [not found] ` <tencent_E465261B2BB2C1EBAF5C19912B9F19B7E107@qq.com>
@ 2023-10-02 13:02   ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2023-10-02 13:02 UTC (permalink / raw)
  To: Woody Zhang
  Cc: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, linux-spi,
	linux-arm-kernel, linux-sunxi, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 441 bytes --]

On Mon, Oct 02, 2023 at 02:29:59PM +0800, Woody Zhang wrote:

> Call spi_master_put to free the spi_master structure on device removal
> and driver detachment.

>  static void sun4i_spi_remove(struct platform_device *pdev)
>  {
> +	struct spi_master *master = dev_get_drvdata(&pdev->dev);
> +
>  	pm_runtime_force_suspend(&pdev->dev);
> +	spi_master_put(master);
>  }

This is just obviously buggy, it doesn't match the registration at all.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2023-10-02 13:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20231002062957.1741396-1-woodylab@foxmail.com>
2023-10-02  6:29 ` [PATCH 1/2] spi: sun6i: Fix memory leak on device removal Woody Zhang
     [not found] ` <tencent_E465261B2BB2C1EBAF5C19912B9F19B7E107@qq.com>
2023-10-02 13:02   ` [PATCH 2/2] spi: sun4i: " Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox