* [PATCH] net: emaclite: Use resource_size
@ 2010-05-06 8:12 Tobias Klauser
2010-05-06 8:23 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Tobias Klauser @ 2010-05-06 8:12 UTC (permalink / raw)
To: netdev, davem; +Cc: john.linn, kernel-janitors, Tobias Klauser
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@distanz.ch>
---
drivers/net/xilinx_emaclite.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index e9381fe..93828d5 100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
@@ -1171,7 +1171,7 @@ static int __devinit xemaclite_of_probe(struct of_device *ofdev,
}
/* Get the virtual base address for the device */
- lp->base_addr = ioremap(r_mem.start, r_mem.end - r_mem.start + 1);
+ lp->base_addr = ioremap(r_mem.start, resource_size(&r_mem));
if (NULL == lp->base_addr) {
dev_err(dev, "EmacLite: Could not allocate iomem\n");
rc = -EIO;
@@ -1224,7 +1224,7 @@ static int __devinit xemaclite_of_probe(struct of_device *ofdev,
return 0;
error1:
- release_mem_region(ndev->mem_start, r_mem.end - r_mem.start + 1);
+ release_mem_region(ndev->mem_start, resource_size(&r_mem));
error2:
xemaclite_remove_ndev(ndev);
--
1.6.3.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: emaclite: Use resource_size
2010-05-06 8:12 [PATCH] net: emaclite: Use resource_size Tobias Klauser
@ 2010-05-06 8:23 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-05-06 8:23 UTC (permalink / raw)
To: tklauser; +Cc: netdev, john.linn, kernel-janitors
From: Tobias Klauser <tklauser@distanz.ch>
Date: Thu, 6 May 2010 10:12:20 +0200
> 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@distanz.ch>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-06 8:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-06 8:12 [PATCH] net: emaclite: Use resource_size Tobias Klauser
2010-05-06 8:23 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).