Commit 75fb026a authored by Julia Lawall's avatar Julia Lawall Committed by James Toy

In this case, the calls to request_mem_region, ioremap, and

release_mem_region all have a consistent length argument, len, but since
in other files (res->end - res->start) + 1, equivalent to
resource_size(res), is used for a resource-typed structure res, one could
consider whether the same should be done here.

The problem was found using the following semantic patch:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
struct resource *res;
@@

- (res->end - res->start) + 1
+ resource_size(res)

@@
struct resource *res;
@@

- res->end - res->start
+ BAD(resource_size(res))
// </smpl>
Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
Acked-by: default avatarFlorian Fainelli <florian@openwrt.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 508b26c3
...@@ -702,7 +702,7 @@ static int vlynq_probe(struct platform_device *pdev) ...@@ -702,7 +702,7 @@ static int vlynq_probe(struct platform_device *pdev)
dev->mem_start = mem_res->start; dev->mem_start = mem_res->start;
dev->mem_end = mem_res->end; dev->mem_end = mem_res->end;
len = regs_res->end - regs_res->start; len = resource_size(regs_res);
if (!request_mem_region(regs_res->start, len, dev_name(&dev->dev))) { if (!request_mem_region(regs_res->start, len, dev_name(&dev->dev))) {
printk(KERN_ERR "%s: Can't request vlynq registers\n", printk(KERN_ERR "%s: Can't request vlynq registers\n",
dev_name(&dev->dev)); dev_name(&dev->dev));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment