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>
This commit is contained in:
@@ -92,7 +92,7 @@ static int simtec_i2c_probe(struct platform_device *dev)
|
||||
goto err;
|
||||
}
|
||||
|
||||
size = (res->end-res->start)+1;
|
||||
size = resource_size(res);
|
||||
|
||||
pd->ioarea = request_mem_region(res->start, size, dev->name);
|
||||
if (pd->ioarea == NULL) {
|
||||
|
Reference in New Issue
Block a user