Re: [PATCH v2 2/2] spi: atcspi200: fix mutex initialization order
From: Pei Xiao
Date: Wed Mar 11 2026 - 22:25:48 EST
在 2026/3/11 20:29, Mark Brown 写道:
> 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...
Thanks for review! I will use mutex_init() for V3 version.