[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20160922094018.2138640-1-arnd@arndb.de>
Date: Thu, 22 Sep 2016 11:39:59 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Bjorn Helgaas <bhelgaas@...gle.com>
Cc: Arnd Bergmann <arnd@...db.de>,
Shawn Lin <shawn.lin@...k-chips.com>,
Wenrui Li <wenrui.li@...k-chips.com>,
Heiko Stuebner <heiko@...ech.de>,
Brian Norris <briannorris@...omium.org>,
linux-pci@...r.kernel.org, linux-rockchip@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] PCI: rockchip: fix uninitialized variable use
The newly added pcie-rockchip driver fails to initialize the
io_size variable if the DT doesn't provide ranges for the PCI
I/O space, as found by building it with -Wmaybe-uninitialized:
drivers/pci/host/pcie-rockchip.c: In function 'rockchip_pcie_probe':
drivers/pci/host/pcie-rockchip.c:1007:6: warning: 'io_size' may be used uninitialized in this function [-Wmaybe-uninitialized]
This adds an appropriate initialization immediately in front of
the loop, so the io_size is zero as expected afterwards for that
case.
Fixes: abe17181b16f ("PCI: rockchip: Add Rockchip PCIe controller support")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
drivers/pci/host/pcie-rockchip.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
index c3593e633ccd..8bedc1e1ef80 100644
--- a/drivers/pci/host/pcie-rockchip.c
+++ b/drivers/pci/host/pcie-rockchip.c
@@ -1078,6 +1078,7 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
goto err_vpcie;
/* Get the I/O and memory ranges from DT */
+ io_size = 0;
resource_list_for_each_entry(win, &res) {
switch (resource_type(win->res)) {
case IORESOURCE_IO:
--
2.9.0
Powered by blists - more mailing lists