SM501: Fix missing uses of resource_size()
From: Ben Dooks
Date: Tue Nov 10 2009 - 12:18:02 EST
There are several places in the SM501 fb driver that could do with using
resource_size() to calculate the size of a resource.
Also fix a bug where request_mem_region() is being passed one too few
bytes when requesting the register memory region, which was causing
the following in /proc/iomem:
13e80000-13e8ffff : sm501-fb.0
13e80000-13e8fffe : sm501-fb
fixed, this reads:
13e80000-13e8ffff : sm501-fb.0
13e80000-13e8ffff : sm501-fb
Signed-off-by: Ben Dooks <ben@xxxxxxxxxxxx>
Signed-off-by: Simtec Linux Team <linux@xxxxxxxxxxxx>
---
drivers/video/sm501fb.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: b/drivers/video/sm501fb.c
===================================================================
--- a/drivers/video/sm501fb.c 2009-11-03 11:17:52.000000000 +0000
+++ b/drivers/video/sm501fb.c 2009-11-03 11:18:36.000000000 +0000
@@ -1338,7 +1338,7 @@ static int sm501fb_start(struct sm501fb_
}
info->regs_res = request_mem_region(res->start,
- res->end - res->start,
+ resource_size(res),
pdev->name);
if (info->regs_res == NULL) {
@@ -1347,7 +1347,7 @@ static int sm501fb_start(struct sm501fb_
goto err_release;
}
- info->regs = ioremap(res->start, (res->end - res->start)+1);
+ info->regs = ioremap(res->start, resource_size(res));
if (info->regs == NULL) {
dev_err(dev, "cannot remap registers\n");
ret = -ENXIO;
@@ -1363,7 +1363,7 @@ static int sm501fb_start(struct sm501fb_
}
info->fbmem_res = request_mem_region(res->start,
- (res->end - res->start)+1,
+ resource_size(res),
pdev->name);
if (info->fbmem_res == NULL) {
dev_err(dev, "cannot claim framebuffer\n");
@@ -1377,7 +1377,7 @@ static int sm501fb_start(struct sm501fb_
goto err_mem_res;
}
- info->fbmem_len = (res->end - res->start)+1;
+ info->fbmem_len = resource_size(res);
/* clear framebuffer memory - avoids garbage data on unused fb */
memset(info->fbmem, 0, info->fbmem_len);
--
Ben (ben@xxxxxxxxx, http://www.fluff.org/)
'a smiley only costs 4 bytes'
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/