ftmac100: use resource_size()
authorDan Carpenter <error27@gmail.com>
Sat, 19 Mar 2011 04:53:03 +0000 (21:53 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 19 Mar 2011 04:53:03 +0000 (21:53 -0700)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ftmac100.c

index 1d6f4b8d393ab8de500c54f81270df8013b6bff2..a31661948c420e0d467c7e8b7bb4ecae4c078de0 100644 (file)
@@ -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;