2009-11-23 17:46:18

by Hartley Sweeten

[permalink] [raw]
Subject: drivers/block/mg_disk.c: use resource_size()

Use resource_size() for ioremap.

The ioremap appears to be passing the incorrect size for the platform
resource. Unfortunately, I can't locate a user in mainline to verify
this. Using resource_size should be the correct fix.

Signed-off-by: H Hartley Sweeten <[email protected]>
Cc: unsik Kim <[email protected]>

---

diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
index e0339aa..02b2583 100644
--- a/drivers/block/mg_disk.c
+++ b/drivers/block/mg_disk.c
@@ -860,7 +860,7 @@ static int mg_probe(struct platform_device *plat_dev)
err = -EINVAL;
goto probe_err_2;
}
- host->dev_base = ioremap(rsc->start , rsc->end + 1);
+ host->dev_base = ioremap(rsc->start, resource_size(rsc));
if (!host->dev_base) {
printk(KERN_ERR "%s:%d ioremap fail\n",
__func__, __LINE__);


2009-11-27 04:32:18

by unsik Kim

[permalink] [raw]
Subject: Re: drivers/block/mg_disk.c: use resource_size()

> Use resource_size() for ioremap.
>
> The ioremap appears to be passing the incorrect size for the platform
> resource.  Unfortunately, I can't locate a user in mainline to verify
> this.  Using resource_size should be the correct fix.

The patch is definitely right. I tested it in ARM platform.
Thank you for your patch.

---
Regards,
unsik Kim <[email protected]>