[PATCH] dmaengine: mpc512x: Use resource_size

From: Tobias Klauser
Date: Thu May 06 2010 - 05:59:05 EST


Use the resource_size function instead of manually calculating the
resource size. This reduces the chance of introducing off-by-one
errors.

Signed-off-by: Tobias Klauser <tklauser@xxxxxxxxxx>
---
drivers/dma/mpc512x_dma.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/mpc512x_dma.c b/drivers/dma/mpc512x_dma.c
index 84326c9..201e6e1 100644
--- a/drivers/dma/mpc512x_dma.c
+++ b/drivers/dma/mpc512x_dma.c
@@ -658,7 +658,7 @@ static int __devinit mpc_dma_probe(struct of_device *op,
}

regs_start = res.start;
- regs_size = res.end - res.start + 1;
+ regs_size = resource_size(&res);

if (!devm_request_mem_region(dev, regs_start, regs_size, DRV_NAME)) {
dev_err(dev, "Error requesting memory region!\n");
--
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/