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

Mark Brown broonie at kernel.org
Mon Oct 2 06:02:17 PDT 2023


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20231002/aaa5d62c/attachment-0001.sig>


More information about the linux-arm-kernel mailing list