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>
This commit is contained in:
committed by
Jeff Garzik
parent
f90f613c3e
commit
041b5eac25
@@ -151,14 +151,14 @@ int __devinit __pata_platform_probe(struct device *dev,
|
||||
*/
|
||||
if (mmio) {
|
||||
ap->ioaddr.cmd_addr = devm_ioremap(dev, io_res->start,
|
||||
io_res->end - io_res->start + 1);
|
||||
resource_size(io_res));
|
||||
ap->ioaddr.ctl_addr = devm_ioremap(dev, ctl_res->start,
|
||||
ctl_res->end - ctl_res->start + 1);
|
||||
resource_size(ctl_res));
|
||||
} else {
|
||||
ap->ioaddr.cmd_addr = devm_ioport_map(dev, io_res->start,
|
||||
io_res->end - io_res->start + 1);
|
||||
resource_size(io_res));
|
||||
ap->ioaddr.ctl_addr = devm_ioport_map(dev, ctl_res->start,
|
||||
ctl_res->end - ctl_res->start + 1);
|
||||
resource_size(ctl_res));
|
||||
}
|
||||
if (!ap->ioaddr.cmd_addr || !ap->ioaddr.ctl_addr) {
|
||||
dev_err(dev, "failed to map IO/CTL base\n");
|
||||
|
Reference in New Issue
Block a user