RE: [patch 06/20] genirq/msi: Check for invalid MSI parent domain usage
From: Thomas Gleixner
Date: Fri Nov 18 2022 - 07:15:54 EST
On Fri, Nov 18 2022 at 07:50, Kevin Tian wrote:
>> From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
>> Sent: Friday, November 11, 2022 9:57 PM
>>
>> @@ -937,13 +937,21 @@ int msi_domain_alloc_irqs_descs_locked(s
>>
>> lockdep_assert_held(&dev->msi.data->mutex);
>>
>> + if (WARN_ON_ONCE(irq_domain_is_msi_parent(domain))) {
>> + ret = -EINVAL;
>> + goto free;
>> + }
>> +
>> + /* Frees allocated descriptors in case of failure. */
>> ret = msi_domain_add_simple_msi_descs(info, dev, nvec);
>> if (ret)
>> return ret;
>
> it's unusual to see a direct return when error unwind is already required
> at an early failure point. is it something which can be improved here?
It's redundant in this case, but you are right it looks weird.