summaryrefslogtreecommitdiffstats
path: root/common/memory.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-05-24 08:52:22 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-07-01 08:18:53 +0200
commit5f03074ea98b64b55c133b35ee144fdc909e6d69 (patch)
tree1a61fd84a5a44d98297014486eca663221ff4cbc /common/memory.c
parent20addb80f65076b3a81c7d778f7b93d445a96841 (diff)
downloadbarebox-5f03074ea98b64b55c133b35ee144fdc909e6d69.tar.gz
barebox-5f03074ea98b64b55c133b35ee144fdc909e6d69.tar.xz
resource: store 'end' instead of 'size' in struct resource
Storing the size instead of the resource end in struct resource was a mistake. 'size' ranges from 0 to UINT[32|64]_MAX + 1 which obviously leads to problems. 'end' on the other hand will never exceed UINT[32|64]_MAX. Also this way we can express a iomem region covering the whole address space. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/memory.c')
-rw-r--r--common/memory.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/memory.c b/common/memory.c
index 3b4a5ef4b3..f04cfac187 100644
--- a/common/memory.c
+++ b/common/memory.c
@@ -122,7 +122,7 @@ void barebox_add_memory_bank(const char *name, resource_size_t start,
struct memory_bank *bank = xzalloc(sizeof(*bank));
struct device_d *dev;
- bank->res = request_iomem_region(name, start, size);
+ bank->res = request_iomem_region(name, start, start + size - 1);
BUG_ON(!bank->res);
@@ -146,7 +146,7 @@ struct resource *request_sdram_region(const char *name, resource_size_t start,
for_each_memory_bank(bank) {
struct resource *res;
- res = request_region(bank->res, name, start, size);
+ res = request_region(bank->res, name, start, start + size - 1);
if (res)
return res;
}