summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2014-11-09 12:10:32 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2014-11-10 07:13:19 +0100
commitedbd3a6ecf9aea5bef999cd7e60dfe076f91c326 (patch)
tree98c6f86080dc131174d85215dc2ca77160d7f81c
parent42bc1ac850707eec935803d5a1a573ebfc5e3012 (diff)
downloadbarebox-edbd3a6ecf9aea5bef999cd7e60dfe076f91c326.tar.gz
pci: mvebu: Fix uninitialized variable in mvebu_get_target_attr()
This is the same fix that was applied to the Linux kernel in commit 56fab6e18944 (PCI: mvebu: Fix uninitialized variable in mvebu_get_tgt_attr()). Fixes: 5a9ba98 ("pci: mvebu: Add PCIe driver") Signed-off-by: Uwe Kleine-K├Ânig <uwe@kleine-koenig.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/pci/pci-mvebu.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/pci/pci-mvebu.c b/drivers/pci/pci-mvebu.c
index 45befbb..a314a68 100644
--- a/drivers/pci/pci-mvebu.c
+++ b/drivers/pci/pci-mvebu.c
@@ -240,7 +240,7 @@ static int mvebu_get_target_attr(struct device_node *np, int devfn,
rangesz = pna + na + ns;
nranges = rlen / sizeof(__be32) / rangesz;
- for (i = 0; i < nranges; i++) {
+ for (i = 0; i < nranges; i++, range += rangesz) {
u32 flags = of_read_number(range, 1);
u32 slot = of_read_number(range + 1, 1);
u64 cpuaddr = of_read_number(range + na, pna);
@@ -250,14 +250,14 @@ static int mvebu_get_target_attr(struct device_node *np, int devfn,
rtype = IORESOURCE_IO;
else if (DT_FLAGS_TO_TYPE(flags) == DT_TYPE_MEM32)
rtype = IORESOURCE_MEM;
+ else
+ continue;
if (slot == PCI_SLOT(devfn) && type == rtype) {
*target = DT_CPUADDR_TO_TARGET(cpuaddr);
*attr = DT_CPUADDR_TO_ATTR(cpuaddr);
return 0;
}
-
- range += rangesz;
}
return -ENOENT;