Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / Atom feed
From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] irqchip/gic-v3-its: Silence warning when its_lpi_alloc_chunks gets inlined
Date: Fri,  2 Oct 2015 16:44:05 +0100
Message-ID: <1443800646-8074-2-git-send-email-marc.zyngier@arm.com> (raw)
In-Reply-To: <1443800646-8074-1-git-send-email-marc.zyngier@arm.com>

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@linaro.org>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@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

  reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-02 15:44 [PATCH 0/2] GICv3 ITS fixes for v4.3 Marc Zyngier
2015-10-02 15:44 ` Marc Zyngier [this message]
2015-10-02 15:44 ` [PATCH 2/2] irqchip/gic-v3-its: Count additional LPIs for the aliased devices Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1443800646-8074-2-git-send-email-marc.zyngier@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-ARM-Kernel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/0 linux-arm-kernel/git/0.git
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/1 linux-arm-kernel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-kernel linux-arm-kernel/ https://lore.kernel.org/linux-arm-kernel \
		linux-arm-kernel@lists.infradead.org
	public-inbox-index linux-arm-kernel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-arm-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git