2013-03-27 21:53:56

by Andrei Epure

[permalink] [raw]
Subject: [PATCH] power: resource_size() instead of computation

Patch found using coccinelle.

Signed-off-by: Andrei Epure <[email protected]>
---
drivers/power/goldfish_battery.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/goldfish_battery.c b/drivers/power/goldfish_battery.c
index c10f460..29eba88 100644
--- a/drivers/power/goldfish_battery.c
+++ b/drivers/power/goldfish_battery.c
@@ -178,7 +178,7 @@ static int goldfish_battery_probe(struct platform_device *pdev)
return -ENODEV;
}

- data->reg_base = devm_ioremap(&pdev->dev, r->start, r->end - r->start + 1);
+ data->reg_base = devm_ioremap(&pdev->dev, r->start, resource_size(r));
if (data->reg_base == NULL) {
dev_err(&pdev->dev, "unable to remap MMIO\n");
return -ENOMEM;
--
1.7.9.5


2013-04-01 06:45:04

by Anton Vorontsov

[permalink] [raw]
Subject: Re: [PATCH] power: resource_size() instead of computation

On Wed, Mar 27, 2013 at 11:53:47PM +0200, Andrei Epure wrote:
> Patch found using coccinelle.
>
> Signed-off-by: Andrei Epure <[email protected]>
> ---

Silviu-Mihai Popescu sent a similar patch ealier, but I added your
Signed-off-by to the commit.

> drivers/power/goldfish_battery.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/power/goldfish_battery.c b/drivers/power/goldfish_battery.c
> index c10f460..29eba88 100644
> --- a/drivers/power/goldfish_battery.c
> +++ b/drivers/power/goldfish_battery.c
> @@ -178,7 +178,7 @@ static int goldfish_battery_probe(struct platform_device *pdev)
> return -ENODEV;
> }
>
> - data->reg_base = devm_ioremap(&pdev->dev, r->start, r->end - r->start + 1);
> + data->reg_base = devm_ioremap(&pdev->dev, r->start, resource_size(r));
> if (data->reg_base == NULL) {
> dev_err(&pdev->dev, "unable to remap MMIO\n");
> return -ENOMEM;
> --
> 1.7.9.5