Re: [patch V3 09/10] scsi: ufs: qcom: Remove the MSI descriptor abuse

From: Thomas Gleixner
Date: Tue Mar 18 2025 - 04:41:03 EST


On Mon, Mar 17 2025 at 12:26, James Bottomley wrote:
>>   nr_irqs = hba->nr_hw_queues - hba-
>> >nr_queues[HCTX_TYPE_POLL];
>> + qi = devm_kcalloc(hba->dev, nr_irqs, sizeof(*qi),
>> GFP_KERNEL);
>> + if (qi)
>
> Typo causing logic inversion: should be !qi here (you need a more
> responsive ! key).

Duh.

>> +cleanup:
>> + for (int idx = 0; qi[idx].irq; idx++)
>> + devm_free_irq(hba->dev, qi[idx].irq, hba);
>> + platform_device_msi_free_irqs_all(hba->dev);
>> + devm_kfree(hba->dev, qi);
>>   return ret;
>>  }
>
> This does seem to be exactly the pattern you describe in 1/10, although

True.

> I'm not entirely convinced that something like the below is more
> readable and safe.

At least the cleanup wants to be in a C function and not hideously
hidden in the DEFINE_FREE() macro.

Let me respin that.

Thanks,

tglx