diff options
author | Julia Lawall <julia@diku.dk> | 2009-07-05 08:37:50 +0200 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2009-07-15 00:03:56 +0100 |
commit | 593308259bbd335eda9c5280cdd1f7883c746211 (patch) | |
tree | 60c9882dec12dfa7a262f1d14a81b8318d45d0f4 /drivers/i2c/busses/i2c-sh_mobile.c | |
parent | 7605fa3b0aedbb6c77471517ba16753f276156d9 (diff) | |
download | kernel-common-593308259bbd335eda9c5280cdd1f7883c746211.tar.gz kernel-common-593308259bbd335eda9c5280cdd1f7883c746211.tar.bz2 kernel-common-593308259bbd335eda9c5280cdd1f7883c746211.zip |
i2c: 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: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'drivers/i2c/busses/i2c-sh_mobile.c')
-rw-r--r-- | drivers/i2c/busses/i2c-sh_mobile.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c index 1c01083b01b5..4f3d99cd1692 100644 --- a/drivers/i2c/busses/i2c-sh_mobile.c +++ b/drivers/i2c/busses/i2c-sh_mobile.c @@ -563,7 +563,7 @@ static int sh_mobile_i2c_probe(struct platform_device *dev) goto err_irq; } - size = (res->end - res->start) + 1; + size = resource_size(res); pd->reg = ioremap(res->start, size); if (pd->reg == NULL) { |