提交 06794eae 编写于 作者: J Joe Perches 提交者: Jiri Kosina

treewide: Fix iomap resource size miscalculations

Convert off-by-1 r->end - r->start to resource_size(r)
Signed-off-by: NJoe Perches <joe@perches.com>
Acked-by: NDavid Brown <davidb@codeaurora.org>
Acked-by: NLinus Walleij <linus.walleij@linaro.org>
Acked-by: NFlorian Fainelli <florian@openwrt.org>
Acked-by: NWim Van Sebroeck <wim@iguana.be>
Acked-by: NRalf Baechle <ralf@linux-mips.org>
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 b0c3af5e
...@@ -416,8 +416,7 @@ struct mbox *mbox_setup(u8 mbox_id, mbox_recv_cb_t *mbox_cb, void *priv) ...@@ -416,8 +416,7 @@ struct mbox *mbox_setup(u8 mbox_id, mbox_recv_cb_t *mbox_cb, void *priv)
dev_dbg(&(mbox->pdev->dev), dev_dbg(&(mbox->pdev->dev),
"Resource name: %s start: 0x%X, end: 0x%X\n", "Resource name: %s start: 0x%X, end: 0x%X\n",
resource->name, resource->start, resource->end); resource->name, resource->start, resource->end);
mbox->virtbase_peer = mbox->virtbase_peer = ioremap(resource->start, resource_size(resource));
ioremap(resource->start, resource->end - resource->start);
if (!mbox->virtbase_peer) { if (!mbox->virtbase_peer) {
dev_err(&(mbox->pdev->dev), "Unable to ioremap peer mbox\n"); dev_err(&(mbox->pdev->dev), "Unable to ioremap peer mbox\n");
mbox = NULL; mbox = NULL;
...@@ -440,8 +439,7 @@ struct mbox *mbox_setup(u8 mbox_id, mbox_recv_cb_t *mbox_cb, void *priv) ...@@ -440,8 +439,7 @@ struct mbox *mbox_setup(u8 mbox_id, mbox_recv_cb_t *mbox_cb, void *priv)
dev_dbg(&(mbox->pdev->dev), dev_dbg(&(mbox->pdev->dev),
"Resource name: %s start: 0x%X, end: 0x%X\n", "Resource name: %s start: 0x%X, end: 0x%X\n",
resource->name, resource->start, resource->end); resource->name, resource->start, resource->end);
mbox->virtbase_local = mbox->virtbase_local = ioremap(resource->start, resource_size(resource));
ioremap(resource->start, resource->end - resource->start);
if (!mbox->virtbase_local) { if (!mbox->virtbase_local) {
dev_err(&(mbox->pdev->dev), "Unable to ioremap local mbox\n"); dev_err(&(mbox->pdev->dev), "Unable to ioremap local mbox\n");
mbox = NULL; mbox = NULL;
......
...@@ -185,7 +185,7 @@ int __init rb532_gpio_init(void) ...@@ -185,7 +185,7 @@ int __init rb532_gpio_init(void)
struct resource *r; struct resource *r;
r = rb532_gpio_reg0_res; 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) { if (!rb532_gpio_chip->regbase) {
printk(KERN_ERR "rb532: cannot remap GPIO register 0\n"); printk(KERN_ERR "rb532: cannot remap GPIO register 0\n");
......
...@@ -679,7 +679,7 @@ static int __devinit mddi_probe(struct platform_device *pdev) ...@@ -679,7 +679,7 @@ static int __devinit mddi_probe(struct platform_device *pdev)
printk(KERN_ERR "mddi: no associated mem resource!\n"); printk(KERN_ERR "mddi: no associated mem resource!\n");
return -ENOMEM; return -ENOMEM;
} }
mddi->base = ioremap(resource->start, resource->end - resource->start); mddi->base = ioremap(resource->start, resource_size(resource));
if (!mddi->base) { if (!mddi->base) {
printk(KERN_ERR "mddi: failed to remap base!\n"); printk(KERN_ERR "mddi: failed to remap base!\n");
ret = -EINVAL; ret = -EINVAL;
......
...@@ -248,7 +248,7 @@ static int __devinit bcm63xx_wdt_probe(struct platform_device *pdev) ...@@ -248,7 +248,7 @@ static int __devinit bcm63xx_wdt_probe(struct platform_device *pdev)
return -ENODEV; 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) { if (!bcm63xx_wdt_device.regs) {
dev_err(&pdev->dev, "failed to remap I/O resources\n"); dev_err(&pdev->dev, "failed to remap I/O resources\n");
return -ENXIO; return -ENXIO;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册