[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250416114122.2191820-3-andriy.shevchenko@linux.intel.com>
Date: Wed, 16 Apr 2025 14:40:34 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: [PATCH v1 2/2] genirq/irqdesc: Balance locking to make sparse happy
Sparse is not happy right now about conditional locking and
complains:
irqdesc.c:899:17: warning: context imbalance in '__irq_get_desc_lock' - wrong count at exit
Refactor the code and use __acquire() to make it happy.
Annotate the function that it acquires the lock in the
similar way how __irq_put_desc_unlock() is marked.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
kernel/irq/irqdesc.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 0afc2b0b03be..cecff0cb13eb 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -899,21 +899,22 @@ unsigned int irq_get_next_irq(unsigned int offset)
struct irq_desc *
__irq_get_desc_lock(unsigned int irq, unsigned long *flags, bool bus,
unsigned int check)
+ __acquires(&desc->lock)
{
struct irq_desc *desc;
desc = irq_to_desc(irq);
if (!desc)
- return NULL;
+ goto lock;
if (check & _IRQ_DESC_CHECK) {
if ((check & _IRQ_DESC_PERCPU) &&
!irq_settings_is_per_cpu_devid(desc))
- return NULL;
+ goto lock;
if (!(check & _IRQ_DESC_PERCPU) &&
irq_settings_is_per_cpu_devid(desc))
- return NULL;
+ goto lock;
}
if (bus)
@@ -921,6 +922,10 @@ __irq_get_desc_lock(unsigned int irq, unsigned long *flags, bool bus,
raw_spin_lock_irqsave(&desc->lock, *flags);
return desc;
+
+lock:
+ __acquire(&desc->lock);
+ return NULL;
}
void __irq_put_desc_unlock(struct irq_desc *desc, unsigned long flags, bool bus)
--
2.47.2
Powered by blists - more mailing lists