[PATCH 1/2] irqchip/gic-v3-its: Silence warning when its_lpi_alloc_chunks gets inlined

Marc Zyngier marc.zyngier at arm.com
Fri Oct 2 08:44:05 PDT 2015


More agressive inlining in recent versions of GCC have uncovered
a new set of warnings:

	drivers/irqchip/irq-gic-v3-its.c: In function its_msi_prepare:
	drivers/irqchip/irq-gic-v3-its.c:1148:26: warning: lpi_base may be used
	uninitialized in this function [-Wmaybe-uninitialized]
	  dev->event_map.lpi_base = lpi_base;
                          ^
	drivers/irqchip/irq-gic-v3-its.c:1116:6: note: lpi_base was declared here
	  int lpi_base;
	      ^
	drivers/irqchip/irq-gic-v3-its.c:1149:25: warning: nr_lpis may be used
	uninitialized in this function [-Wmaybe-uninitialized]
	  dev->event_map.nr_lpis = nr_lpis;
	                         ^
	drivers/irqchip/irq-gic-v3-its.c:1117:6: note: nr_lpis was declared here
	  int nr_lpis;
	      ^
The warning is fairly benign (there is no code path that could
actually use uninitialized vatiables), but let's silence it anyway
by zeroing the variables on the error path.

Reported-by: Alex Shi <alex.shi at linaro.org>
Tested-by: Ard Biesheuvel <ard.biesheuvel at linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier at arm.com>
---
 drivers/irqchip/irq-gic-v3-its.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index ac7ae2b..25ceae9f 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -719,6 +719,9 @@ static unsigned long *its_lpi_alloc_chunks(int nr_irqs, int *base, int *nr_ids)
 out:
 	spin_unlock(&lpi_lock);
 
+	if (!bitmap)
+		*base = *nr_ids = 0;
+
 	return bitmap;
 }
 
-- 
2.1.4




More information about the linux-arm-kernel mailing list