]> git.karo-electronics.de Git - linux-beck.git/commitdiff
treewide: Fix iomap resource size miscalculations
authorJoe Perches <joe@perches.com>
Wed, 23 Mar 2011 19:55:36 +0000 (12:55 -0700)
committerJiri Kosina <jkosina@suse.cz>
Sun, 10 Apr 2011 15:01:04 +0000 (17:01 +0200)
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>
arch/arm/mach-ux500/mbox-db5500.c
arch/mips/rb532/gpio.c
drivers/video/msm/mddi.c
drivers/watchdog/bcm63xx_wdt.c

index a4ffb9f4f4614366fae99d7af5f6e337d7110f9f..2b2d51caf9d8b9f4db2e62c1eaa7a596b3313546 100644 (file)
@@ -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;
@@ -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;
index 37de05d595e725ebdc59513181d3f43709ce1cb4..6c47dfeb7be326bf2dc4c5a7a1cbb1984b87efec 100644 (file)
@@ -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");
index b66d86ac7cea6d19a9ffa4b7fd5a0034ee702cc2..178b0720bd79a96d55e6d786fe8a183940263de2 100644 (file)
@@ -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;
index 3c5045a206ddbded9e82fbb9db41fa5fa50c178d..5064e831752128a41ee810dbb854af8ef1cadb40 100644 (file)
@@ -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;