From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Date: Tue, 17 Sep 2013 20:11:04 +0000 (-0600)
Subject: bus: mvebu-mbus: Fix optional pcie-mem/io-aperture properties
X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=8553bcad3eca6cdd19c4771c378bd2cf6e25c6b2;p=linux.git

bus: mvebu-mbus: Fix optional pcie-mem/io-aperture properties

If the property was not specified then the returned resource had a
resource_size(..) == 1, rather than 0. The PCI-E driver checks for 0 so it
blindly continues on with a corrupted resource.

The regression was introduced into v3.12 by:

  11be654 PCI: mvebu: Adapt to the new device tree layout

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
---

diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
index 5531853189639..2394e9753ef56 100644
--- a/drivers/bus/mvebu-mbus.c
+++ b/drivers/bus/mvebu-mbus.c
@@ -865,11 +865,13 @@ static void __init mvebu_mbus_get_pcie_resources(struct device_node *np,
 	int ret;
 
 	/*
-	 * These are optional, so we clear them and they'll
-	 * be zero if they are missing from the DT.
+	 * These are optional, so we make sure that resource_size(x) will
+	 * return 0.
 	 */
 	memset(mem, 0, sizeof(struct resource));
+	mem->end = -1;
 	memset(io, 0, sizeof(struct resource));
+	io->end = -1;
 
 	ret = of_property_read_u32_array(np, "pcie-mem-aperture", reg, ARRAY_SIZE(reg));
 	if (!ret) {