* [patch] ftmac100: use resource_size()
@ 2011-03-19 4:39 Dan Carpenter
2011-03-19 4:53 ` David Miller
2011-03-19 5:05 ` Po-Yu Chuang
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2011-03-19 4:39 UTC (permalink / raw)
To: Po-Yu Chuang; +Cc: Eric Dumazet, David S. Miller, netdev, kernel-janitors
The calculation is off-by-one. It should be "end - start + 1". This
patch fixes it to use resource_size() instead. Oddly, the code already
uses resource size correctly a couple lines earlier when it calls
request_mem_region() for this memory.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c
index 1d6f4b8..a316619 100644
--- a/drivers/net/ftmac100.c
+++ b/drivers/net/ftmac100.c
@@ -1102,7 +1102,7 @@ static int ftmac100_probe(struct platform_device *pdev)
goto err_req_mem;
}
- priv->base = ioremap(res->start, res->end - res->start);
+ priv->base = ioremap(res->start, resource_size(res));
if (!priv->base) {
dev_err(&pdev->dev, "Failed to ioremap ethernet registers\n");
err = -EIO;
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [patch] ftmac100: use resource_size()
2011-03-19 4:39 [patch] ftmac100: use resource_size() Dan Carpenter
@ 2011-03-19 4:53 ` David Miller
2011-03-19 5:05 ` Po-Yu Chuang
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2011-03-19 4:53 UTC (permalink / raw)
To: error27; +Cc: ratbert, eric.dumazet, netdev, kernel-janitors
From: Dan Carpenter <error27@gmail.com>
Date: Sat, 19 Mar 2011 07:39:15 +0300
> The calculation is off-by-one. It should be "end - start + 1". This
> patch fixes it to use resource_size() instead. Oddly, the code already
> uses resource size correctly a couple lines earlier when it calls
> request_mem_region() for this memory.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Applied, thanks for fixing this Dan.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] ftmac100: use resource_size()
2011-03-19 4:39 [patch] ftmac100: use resource_size() Dan Carpenter
2011-03-19 4:53 ` David Miller
@ 2011-03-19 5:05 ` Po-Yu Chuang
1 sibling, 0 replies; 3+ messages in thread
From: Po-Yu Chuang @ 2011-03-19 5:05 UTC (permalink / raw)
To: Dan Carpenter
Cc: Po-Yu Chuang, Eric Dumazet, David S. Miller, netdev,
kernel-janitors
Hi Dan,
On Sat, Mar 19, 2011 at 12:39 PM, Dan Carpenter <error27@gmail.com> wrote:
> The calculation is off-by-one. It should be "end - start + 1". This
> patch fixes it to use resource_size() instead. Oddly, the code already
> uses resource size correctly a couple lines earlier when it calls
> request_mem_region() for this memory.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
> diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c
> index 1d6f4b8..a316619 100644
> --- a/drivers/net/ftmac100.c
> +++ b/drivers/net/ftmac100.c
> @@ -1102,7 +1102,7 @@ static int ftmac100_probe(struct platform_device *pdev)
> goto err_req_mem;
> }
>
> - priv->base = ioremap(res->start, res->end - res->start);
> + priv->base = ioremap(res->start, resource_size(res));
> if (!priv->base) {
> dev_err(&pdev->dev, "Failed to ioremap ethernet registers\n");
> err = -EIO;
Ah, I incautiously missed that line when code review.
Thanks,
Po-Yu Chuang
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-03-19 5:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-19 4:39 [patch] ftmac100: use resource_size() Dan Carpenter
2011-03-19 4:53 ` David Miller
2011-03-19 5:05 ` Po-Yu Chuang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox