Skip to content

Commit

Permalink
treewide: Fix iomap resource size miscalculations
Browse files Browse the repository at this point in the history
Convert off-by-1 r->end - r->start to resource_size(r)

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: David Brown <davidb@codeaurora.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Florian Fainelli <florian@openwrt.org>
Acked-by: Wim Van Sebroeck <wim@iguana.be>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Joe Perches authored and Jiri Kosina committed Apr 10, 2011
1 parent b0c3af5 commit 06794ea
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions arch/arm/mach-ux500/mbox-db5500.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,7 @@ struct mbox *mbox_setup(u8 mbox_id, mbox_recv_cb_t *mbox_cb, void *priv)
dev_dbg(&(mbox->pdev->dev),
"Resource name: %s start: 0x%X, end: 0x%X\n",
resource->name, resource->start, resource->end);
mbox->virtbase_peer =
ioremap(resource->start, resource->end - resource->start);
mbox->virtbase_peer = ioremap(resource->start, resource_size(resource));
if (!mbox->virtbase_peer) {
dev_err(&(mbox->pdev->dev), "Unable to ioremap peer mbox\n");
mbox = NULL;
Expand All @@ -440,8 +439,7 @@ struct mbox *mbox_setup(u8 mbox_id, mbox_recv_cb_t *mbox_cb, void *priv)
dev_dbg(&(mbox->pdev->dev),
"Resource name: %s start: 0x%X, end: 0x%X\n",
resource->name, resource->start, resource->end);
mbox->virtbase_local =
ioremap(resource->start, resource->end - resource->start);
mbox->virtbase_local = ioremap(resource->start, resource_size(resource));
if (!mbox->virtbase_local) {
dev_err(&(mbox->pdev->dev), "Unable to ioremap local mbox\n");
mbox = NULL;
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/rb532/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ int __init rb532_gpio_init(void)
struct resource *r;

r = rb532_gpio_reg0_res;
rb532_gpio_chip->regbase = ioremap_nocache(r->start, r->end - r->start);
rb532_gpio_chip->regbase = ioremap_nocache(r->start, resource_size(r));

if (!rb532_gpio_chip->regbase) {
printk(KERN_ERR "rb532: cannot remap GPIO register 0\n");
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/msm/mddi.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ static int __devinit mddi_probe(struct platform_device *pdev)
printk(KERN_ERR "mddi: no associated mem resource!\n");
return -ENOMEM;
}
mddi->base = ioremap(resource->start, resource->end - resource->start);
mddi->base = ioremap(resource->start, resource_size(resource));
if (!mddi->base) {
printk(KERN_ERR "mddi: failed to remap base!\n");
ret = -EINVAL;
Expand Down
2 changes: 1 addition & 1 deletion drivers/watchdog/bcm63xx_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ static int __devinit bcm63xx_wdt_probe(struct platform_device *pdev)
return -ENODEV;
}

bcm63xx_wdt_device.regs = ioremap_nocache(r->start, r->end - r->start);
bcm63xx_wdt_device.regs = ioremap_nocache(r->start, resource_size(r));
if (!bcm63xx_wdt_device.regs) {
dev_err(&pdev->dev, "failed to remap I/O resources\n");
return -ENXIO;
Expand Down

0 comments on commit 06794ea

Please sign in to comment.