Skip to contentSkip to conversation

power: resource_size() instead of computation

PATCH In review Andrei Epure 2 participants 2 messages Mar 27, 2013 – Apr 1, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power: resource_size() instead of computation

Patch found using coccinelle.

---
 drivers/power/goldfish_battery.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/goldfish_battery.c +1 -1
index c10f460..29eba88 100644
@@ -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;
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 4 lines · Andrei Epure

Patch found using coccinelle.

---

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

Quoted 18 lines
 drivers/power/goldfish_battery.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/goldfish_battery.c +1 -1
index c10f460..29eba88 100644
@@ -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;
Signature · 1 line
1.7.9.5