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

From: Mark Brown
Date: Mon Oct 02 2023 - 09:02:27 EST


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: signature.asc
Description: PGP signature