summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/vt1211.c
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2009-09-15 17:18:13 +0200
committerJean Delvare <khali@linux-fr.org>2009-09-15 17:18:13 +0200
commit86855b0c1fd75338c67cabbf85d64d033612c47b (patch)
tree69b20b9059bc9d317fcb68a77ce988acce8577ef /drivers/hwmon/vt1211.c
parent6055fae8aceee41471edfd1876e5617d16e028fe (diff)
downloadop-kernel-dev-86855b0c1fd75338c67cabbf85d64d033612c47b.zip
op-kernel-dev-86855b0c1fd75338c67cabbf85d64d033612c47b.tar.gz
hwmon: Use resource_size
Use the function resource_size, which reduces the chance of introducing off-by-one errors in calculating the resource size. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @@ struct resource *res; @@ - (res->end - res->start) + 1 + resource_size(res) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/vt1211.c')
-rw-r--r--drivers/hwmon/vt1211.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/hwmon/vt1211.c b/drivers/hwmon/vt1211.c
index 120b5d6..ae33bbb 100644
--- a/drivers/hwmon/vt1211.c
+++ b/drivers/hwmon/vt1211.c
@@ -1136,7 +1136,7 @@ static int __devinit vt1211_probe(struct platform_device *pdev)
}
res = platform_get_resource(pdev, IORESOURCE_IO, 0);
- if (!request_region(res->start, res->end - res->start + 1, DRVNAME)) {
+ if (!request_region(res->start, resource_size(res), DRVNAME)) {
err = -EBUSY;
dev_err(dev, "Failed to request region 0x%lx-0x%lx\n",
(unsigned long)res->start, (unsigned long)res->end);
@@ -1209,7 +1209,7 @@ EXIT_DEV_REMOVE:
dev_err(dev, "Sysfs interface creation failed (%d)\n", err);
EXIT_DEV_REMOVE_SILENT:
vt1211_remove_sysfs(pdev);
- release_region(res->start, res->end - res->start + 1);
+ release_region(res->start, resource_size(res));
EXIT_KFREE:
platform_set_drvdata(pdev, NULL);
kfree(data);
@@ -1228,7 +1228,7 @@ static int __devexit vt1211_remove(struct platform_device *pdev)
kfree(data);
res = platform_get_resource(pdev, IORESOURCE_IO, 0);
- release_region(res->start, res->end - res->start + 1);
+ release_region(res->start, resource_size(res));
return 0;
}
OpenPOWER on IntegriCloud