Re: [PATCH v2 2/2] spi: atcspi200: fix mutex initialization order
From: Mark Brown
Date: Wed Mar 11 2026 - 08:29:37 EST
On Wed, Mar 11, 2026 at 09:55:14AM +0800, Pei Xiao wrote:
> @@ -551,6 +551,10 @@ static int atcspi_probe(struct platform_device *pdev)
> spi->dev = &pdev->dev;
> dev_set_drvdata(&pdev->dev, host);
>
> + ret = devm_mutex_init(spi->dev, &spi->mutex_lock);
> + if (ret)
> + goto free_controller;
> +
This means we're now using devm to free the mutex that is in spi, but
when we pass spi into devm_spi_register_controller() we'll cause spi to
be freed before we free the mutex. This pattern gets a bit clunky with
devm...
Attachment:
signature.asc
Description: PGP signature