spi: sun6i: Fix memory leak on device removal
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/2 spi: sun6i: Fix memory leak on device removal
Call spi_master_put to free the spi_master structure on device removal and driver detachment.
--- drivers/spi/spi-sun6i.c | 1 + 1 file changed, 1 insertion(+)
drivers/spi/spi-sun6i.c +1 -0
@@ -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 = {
Signature · 1 line
2.39.2
PATCH 2/2 spi: sun4i: Fix memory leak on device removal
In reply to a message not in the archiveCall spi_master_put to free the spi_master structure on device removal and driver detachment.
--- drivers/spi/spi-sun4i.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/spi/spi-sun4i.c +3 -0
@@ -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[] = {
Signature · 7 lines
2.39.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Mark Brown
maintainerRe: [PATCH 2/2] spi: sun4i: Fix memory leak on device removal
drivers/spi/spi-sun4i.c static int sun4i_spi_probe(struct platform_device *pdev) · line 525
Quoted 10 lines · Woody Zhang
Call
spi_master_putto free thespi_masterstructure on device removal and driver detachment.static void
sun4i_spi_remove(struct platform_device *pdev){drivers/spi/spi-sun4i.c +3
-0+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.