linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] bus: mvebu-mbus: Fix optional pcie-mem/io-aperture properties
@ 2013-09-17 20:11 Jason Gunthorpe
  2013-10-01 16:44 ` Jason Cooper
  0 siblings, 1 reply; 6+ messages in thread
From: Jason Gunthorpe @ 2013-09-17 20:11 UTC (permalink / raw)
  To: linux-arm-kernel

If the property was not specified then 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.

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
---
 drivers/bus/mvebu-mbus.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

- Revise the comment to clarify the code is setting resource_size(x)
  to 0 [Thomas]
- Use -1 instead of -- for clarity

diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
index 19ab6ff..8aa6cdd 100644
--- a/drivers/bus/mvebu-mbus.c
+++ b/drivers/bus/mvebu-mbus.c
@@ -861,11 +861,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) {
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-10-01 17:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-17 20:11 [PATCH v2] bus: mvebu-mbus: Fix optional pcie-mem/io-aperture properties Jason Gunthorpe
2013-10-01 16:44 ` Jason Cooper
2013-10-01 16:50   ` Jason Gunthorpe
2013-10-01 17:09     ` Jason Cooper
2013-10-01 17:22       ` Jason Gunthorpe
2013-10-01 17:28         ` Jason Cooper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).