mirror of https://lore.kernel.org/lkml/
 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
  2023-10-02  6:29 ` [PATCH 2/2] spi: sun4i: " Woody Zhang
  1 sibling, 0 replies; 3+ 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	[flat|nested] 3+ messages in thread

* [PATCH 2/2] spi: sun4i: Fix memory leak on device removal
       [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
@ 2023-10-02  6:29 ` Woody Zhang
  2023-10-02 13:02   ` Mark Brown
  1 sibling, 1 reply; 3+ 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-sun4i.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/spi/spi-sun4i.c b/drivers/spi/spi-sun4i.c
index b8947265d329..ba5690039f72 100644
--- a/drivers/spi/spi-sun4i.c
+++ b/drivers/spi/spi-sun4i.c
@@ -518,7 +518,10 @@ static int sun4i_spi_probe(struct platform_device *pdev)
 
 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);
 }
 
 static const struct of_device_id sun4i_spi_match[] = {
-- 
2.39.2


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

* Re: [PATCH 2/2] spi: sun4i: Fix memory leak on device removal
  2023-10-02  6:29 ` [PATCH 2/2] spi: sun4i: " Woody Zhang
@ 2023-10-02 13:02   ` Mark Brown
  0 siblings, 0 replies; 3+ 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] 3+ messages in thread

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

Thread overview: 3+ 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
2023-10-02  6:29 ` [PATCH 2/2] spi: sun4i: " Woody Zhang
2023-10-02 13:02   ` Mark Brown

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

all inboxes | Powered by JetHome®