summaryrefslogtreecommitdiffstats
path: root/common/uimage.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/uimage.c
parent20addb80f65076b3a81c7d778f7b93d445a96841 (diff)
downloadbarebox-5f03074ea98b64b55c133b35ee144fdc909e6d69.tar.gz
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/uimage.c')
-rw-r--r--common/uimage.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/common/uimage.c b/common/uimage.c
index 945f3d6..43878b5 100644
--- a/common/uimage.c
+++ b/common/uimage.c
@@ -354,9 +354,9 @@ static struct resource *uimage_resource;
static int uimage_sdram_flush(void *buf, unsigned int len)
{
- if (uimage_size + len > uimage_resource->size) {
- resource_size_t start = uimage_resource->start;
- resource_size_t size = uimage_resource->size + len;
+ if (uimage_size + len > resource_size(uimage_resource)) {
+ resource_size_t start = resource_size(uimage_resource);
+ resource_size_t size = resource_size(uimage_resource) + len;
release_sdram_region(uimage_resource);
uimage_resource = request_sdram_region("uimage",