diff options
author | Dan Carpenter <error27@gmail.com> | 2010-04-08 00:50:08 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-08 00:50:08 -0400 |
commit | b62226826b4ea1926b644b5a337ffa6b637d4870 (patch) | |
tree | b71b2447cff878044a7afa54bb2cbf73219467a2 | |
parent | ddd0451fc8dbf94446c81500ff0dcee06c4057cb (diff) |
stmmac: use resource_size()
Resource size should be calculated as end - start + 1 because we start
counting at zero. I changed the code to resource_size() to do the
calculation.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/stmmac/stmmac_main.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c index a6733612d64a..55317adec33d 100644 --- a/drivers/net/stmmac/stmmac_main.c +++ b/drivers/net/stmmac/stmmac_main.c | |||
@@ -1685,7 +1685,7 @@ static int stmmac_dvr_probe(struct platform_device *pdev) | |||
1685 | } | 1685 | } |
1686 | pr_info("done!\n"); | 1686 | pr_info("done!\n"); |
1687 | 1687 | ||
1688 | if (!request_mem_region(res->start, (res->end - res->start), | 1688 | if (!request_mem_region(res->start, resource_size(res), |
1689 | pdev->name)) { | 1689 | pdev->name)) { |
1690 | pr_err("%s: ERROR: memory allocation failed" | 1690 | pr_err("%s: ERROR: memory allocation failed" |
1691 | "cannot get the I/O addr 0x%x\n", | 1691 | "cannot get the I/O addr 0x%x\n", |
@@ -1694,9 +1694,9 @@ static int stmmac_dvr_probe(struct platform_device *pdev) | |||
1694 | goto out; | 1694 | goto out; |
1695 | } | 1695 | } |
1696 | 1696 | ||
1697 | addr = ioremap(res->start, (res->end - res->start)); | 1697 | addr = ioremap(res->start, resource_size(res)); |
1698 | if (!addr) { | 1698 | if (!addr) { |
1699 | pr_err("%s: ERROR: memory mapping failed \n", __func__); | 1699 | pr_err("%s: ERROR: memory mapping failed\n", __func__); |
1700 | ret = -ENOMEM; | 1700 | ret = -ENOMEM; |
1701 | goto out; | 1701 | goto out; |
1702 | } | 1702 | } |
@@ -1774,7 +1774,7 @@ static int stmmac_dvr_probe(struct platform_device *pdev) | |||
1774 | out: | 1774 | out: |
1775 | if (ret < 0) { | 1775 | if (ret < 0) { |
1776 | platform_set_drvdata(pdev, NULL); | 1776 | platform_set_drvdata(pdev, NULL); |
1777 | release_mem_region(res->start, (res->end - res->start)); | 1777 | release_mem_region(res->start, resource_size(res)); |
1778 | if (addr != NULL) | 1778 | if (addr != NULL) |
1779 | iounmap(addr); | 1779 | iounmap(addr); |
1780 | } | 1780 | } |
@@ -1812,7 +1812,7 @@ static int stmmac_dvr_remove(struct platform_device *pdev) | |||
1812 | 1812 | ||
1813 | iounmap((void *)ndev->base_addr); | 1813 | iounmap((void *)ndev->base_addr); |
1814 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1814 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1815 | release_mem_region(res->start, (res->end - res->start)); | 1815 | release_mem_region(res->start, resource_size(res)); |
1816 | 1816 | ||
1817 | free_netdev(ndev); | 1817 | free_netdev(ndev); |
1818 | 1818 | ||