[PATCH 1/2] spi: sun6i: Fix memory leak on device removal

From: Woody Zhang
Date: Mon Oct 02 2023 - 02:31:22 EST


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

Signed-off-by: Woody Zhang <woodylab@xxxxxxxxxxx>
---
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