[PATCH v3 2/2] spi: atmel-quadspi: Add support for sama7g5 QSPI

Csókás Bence csokas.bence at prolan.hu
Tue Jan 14 09:21:52 PST 2025


Hi,

On 2025. 01. 10. 8:56, Alexander Dahl wrote:
> Hello,
> 
> found another suspicious area regarding pm_runtime in
> atmel_qspi_probe(), see below (irrelevant stuff dropped this time) …
> 
> Am Thu, Nov 28, 2024 at 06:43:15PM +0100 schrieb Csókás, Bence:
>> From: Tudor Ambarus <tudor.ambarus at microchip.com>
>>
> 
> […]
> 
>>   	pm_runtime_set_autosuspend_delay(&pdev->dev, 500);
>>   	pm_runtime_use_autosuspend(&pdev->dev);
>> @@ -745,7 +1444,9 @@ static int atmel_qspi_probe(struct platform_device *pdev)
>>   	pm_runtime_enable(&pdev->dev);
>>   	pm_runtime_get_noresume(&pdev->dev);
>>   
>> -	atmel_qspi_init(aq);
>> +	err = atmel_qspi_init(aq);
>> +	if (err)
>> +		goto dma_release;
> 
> This error handling leads to unbalanced pm_runtime right?  The block
> below rolls back pm_runtime before jumping to 'dma_release', this here
> does not.
> 
>>   	err = spi_register_controller(ctrl);
>>   	if (err) {
>> @@ -753,13 +1454,16 @@ static int atmel_qspi_probe(struct platform_device *pdev)
>>   		pm_runtime_disable(&pdev->dev);
>>   		pm_runtime_set_suspended(&pdev->dev);
>>   		pm_runtime_dont_use_autosuspend(&pdev->dev);
>> -		goto disable_qspick;
>> +		goto dma_release;
>>   	}
> 
> This hunk got it right?

Hm, I think this would be best handled by switching to 
`devm_pm_runtime_enable()`... I'll add that to my upcoming "make 
everything use devm_*()"-series... (but I'm waiting on new functions to 
be added to dmaengine for that).

Bence




More information about the linux-arm-kernel mailing list