* [PATCH] stmmac: Fix incorrect resource calculation
@ 2010-04-08 1:28 Axel Lin
2010-04-08 4:49 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2010-04-08 1:28 UTC (permalink / raw)
To: linux-kernel; +Cc: Giuseppe Cavallaro, David S. Miller
The size calculation is not correct. It should be end - start + 1.
Use resource_size for {request/release}_mem_region and ioremap.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/net/stmmac/stmmac_main.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c
index a214a16..f613a07 100644
--- a/drivers/net/stmmac/stmmac_main.c
+++ b/drivers/net/stmmac/stmmac_main.c
@@ -1686,7 +1686,7 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
}
pr_info("done!\n");
- if (!request_mem_region(res->start, (res->end - res->start),
+ if (!request_mem_region(res->start, resource_size(res),
pdev->name)) {
pr_err("%s: ERROR: memory allocation failed"
"cannot get the I/O addr 0x%x\n",
@@ -1695,7 +1695,7 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
goto out;
}
- addr = ioremap(res->start, (res->end - res->start));
+ addr = ioremap(res->start, resource_size(res));
if (!addr) {
pr_err("%s: ERROR: memory mapping failed \n", __func__);
ret = -ENOMEM;
@@ -1775,7 +1775,7 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
out:
if (ret < 0) {
platform_set_drvdata(pdev, NULL);
- release_mem_region(res->start, (res->end - res->start));
+ release_mem_region(res->start, resource_size(res));
if (addr != NULL)
iounmap(addr);
}
@@ -1813,7 +1813,7 @@ static int stmmac_dvr_remove(struct platform_device *pdev)
iounmap((void *)ndev->base_addr);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- release_mem_region(res->start, (res->end - res->start));
+ release_mem_region(res->start, resource_size(res));
free_netdev(ndev);
--
1.5.4.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] stmmac: Fix incorrect resource calculation
2010-04-08 1:28 [PATCH] stmmac: Fix incorrect resource calculation Axel Lin
@ 2010-04-08 4:49 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-04-08 4:49 UTC (permalink / raw)
To: axel.lin; +Cc: linux-kernel, peppe.cavallaro
From: Axel Lin <axel.lin@gmail.com>
Date: Thu, 8 Apr 2010 09:28:02 +0800
> The size calculation is not correct. It should be end - start + 1.
> Use resource_size for {request/release}_mem_region and ioremap.
>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
A patch doing this was already submitted by Dan Carpenter to
the netdev list yesterday, and I will be applying his patch
right now.
And for future submissions, all networking patches should be at least
CC:'d to netdev.
Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-04-08 4:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-08 1:28 [PATCH] stmmac: Fix incorrect resource calculation Axel Lin
2010-04-08 4:49 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.