Re: [PATCH] spi: fix resource leaks on device setup failure

From: Mark Brown

Date: Tue Mar 24 2026 - 09:28:35 EST


On Tue, Mar 24, 2026 at 11:30:42AM +0100, Johan Hovold wrote:

> Make sure to call controller cleanup() on late device setup failures to
> avoid leaking resources allocated by setup().

> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -4091,7 +4091,7 @@ int spi_setup(struct spi_device *spi)

This is specifically setup(). This is called repeatedly at runtime,
it's not part of the device registration flow like the issues that were
addressed by the commit you tagged as a fix. Can you be more specific
about the leak you're trying to fix here?

> +err_cleanup:
> + if (spi->controller->cleanup)
> + spi->controller->cleanup(spi);

spi_cleanup()

Attachment: signature.asc
Description: PGP signature