[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b07ba47f-2709-6b10-2332-7a0d163401bc@foss.st.com>
Date: Mon, 17 Jan 2022 08:37:45 +0100
From: Patrice CHOTARD <patrice.chotard@...s.st.com>
To: Lukas Wunner <lukas@...ner.de>
CC: Mark Brown <broonie@...nel.org>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
<linux-spi@...r.kernel.org>,
<linux-stm32@...md-mailman.stormreply.com>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <christophe.kerello@...s.st.com>,
<stable@...r.kernel.org>
Subject: Re: [PATCH v2] spi: stm32-qspi: Update spi registering
Hi Lukas
On 1/16/22 1:52 PM, Lukas Wunner wrote:
> On Wed, Jan 12, 2022 at 03:44:24PM +0100, patrice.chotard@...s.st.com wrote:
>> diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c
>> index 514337c86d2c..09839a3dbb26 100644
>> --- a/drivers/spi/spi-stm32-qspi.c
>> +++ b/drivers/spi/spi-stm32-qspi.c
>> @@ -688,7 +688,7 @@ static int stm32_qspi_probe(struct platform_device *pdev)
>> struct resource *res;
>> int ret, irq;
>>
>> - ctrl = spi_alloc_master(dev, sizeof(*qspi));
>> + ctrl = devm_spi_alloc_master(dev, sizeof(*qspi));
>> if (!ctrl)
>> return -ENOMEM;
>>
>> @@ -784,7 +784,7 @@ static int stm32_qspi_probe(struct platform_device *pdev)
>> pm_runtime_enable(dev);
>> pm_runtime_get_noresume(dev);
>>
>> - ret = devm_spi_register_master(dev, ctrl);
>> + ret = spi_register_master(ctrl);
>> if (ret)
>> goto err_pm_runtime_free;
>>
>
> Unfortunately this patch is still not correct: It introduces a
> double free in the probe error path.
Argh yes, my bad.
>
> You need to remove this...
>
> err_master_put:
> spi_master_put(qspi->ctrl);
>
> ...and replace all the gotos in stm32_qspi_probe() which jump
> to the err_master_put label with a return statement.
>
> Thanks,
>
> Lukas
>
Thanks
Patrice
Powered by blists - more mailing lists