Skip to content

Commit b5fcb68

Browse files
nathanchanceKAGA-KOKO
authored andcommitted
genirq: Ensure flags in lock guard is consistently initialized
After the conversion to locking guards within the interrupt core code, several builds with clang show the "Interrupts were enabled early" WARN() in start_kernel() on boot. In class_irqdesc_lock_constructor(), _t.flags is initialized via __irq_get_desc_lock() within the _t initializer list. However, the C11 standard 6.7.9.23 states that the evaluation of the initialization list expressions are indeterminately sequenced relative to one another, meaning _t.flags could be initialized by __irq_get_desc_lock() then be initialized to zero due to flags being absent from the initializer list. To ensure _t.flags is consistently initialized, move the call to __irq_get_desc_lock() and the assignment of its result to _t.lock out of the designated initializer. Fixes: 0f70a49 ("genirq: Provide conditional lock guards") Signed-off-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Link: https://lore.kernel.org/all/20250513-irq-guards-fix-flags-init-v1-1-1dca3f5992d6@kernel.org
1 parent c1ab449 commit b5fcb68

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

kernel/irq/internals.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@ __DEFINE_UNLOCK_GUARD(irqdesc_lock, struct irq_desc,
176176
static inline class_irqdesc_lock_t class_irqdesc_lock_constructor(unsigned int irq, bool bus,
177177
unsigned int check)
178178
{
179-
class_irqdesc_lock_t _t = {
180-
.bus = bus,
181-
.lock = __irq_get_desc_lock(irq, &_t.flags, bus, check),
182-
};
179+
class_irqdesc_lock_t _t = { .bus = bus, };
180+
181+
_t.lock = __irq_get_desc_lock(irq, &_t.flags, bus, check);
182+
183183
return _t;
184184
}
185185

0 commit comments

Comments
 (0)