Re: [PATCH v2] genirq/irqdesc: fix WARNING in irq_sysfs_del()

From: Thomas Gleixner
Date: Mon Nov 28 2022 - 13:55:26 EST


On Mon, Nov 28 2022 at 18:20, Greg KH wrote:
> On Mon, Nov 28, 2022 at 11:16:12PM +0800, Yang Yingliang wrote:
>> @@ -292,6 +292,8 @@ static void irq_sysfs_add(int irq, struct irq_desc *desc)
>> */
>> if (kobject_add(&desc->kobj, irq_kobj_base, "%d", irq))
>> pr_warn("Failed to add kobject for irq %d\n", irq);
>> + else
>> + desc->sysfs_added = true;
>
> Wait, no. Why are you just not properly failing and unwinding here?

There is an issue here.

sysfs is not yet available when the first interrupts are allocated. So
we add the sysfs files late in the boot.

So what can we do if that fails? Unwind the boot process? :)

Sure we can fail after sysfs has been initialized, but that's
inconsistent at best and we need some special treatment for the late add
anyway.

I agree that this is not pretty, but the resulting choices are all but
pretty.

Thanks,

tglx