drivers/ata: 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>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
这个提交包含在:
Julia Lawall
2009-08-06 16:05:08 -07:00
提交者 Jeff Garzik
父节点 f90f613c3e
当前提交 041b5eac25
修改 4 个文件,包含 7 行新增7 行删除

查看文件

@@ -841,7 +841,7 @@ static int __devinit octeon_cf_probe(struct platform_device *pdev)
ocd = pdev->dev.platform_data;
cs0 = devm_ioremap_nocache(&pdev->dev, res_cs0->start,
res_cs0->end - res_cs0->start + 1);
resource_size(res_cs0));
if (!cs0)
return -ENOMEM;