aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cpmac.c
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-06-30 16:12:01 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-30 16:12:01 -0400
commit7e307c7ad5340b226966da6e564ec7f717da3adb (patch)
treef9e6d1a1fb34dc37cf45ac8dbf2c6eb45725ab74 /drivers/net/cpmac.c
parent504f85c9d05f7c605306e808f0d835fe11bfd18d (diff)
cpmac: use resource_size()
The original code is off by one because we should start counting at zero. So the size of the resource is end - start + 1. I switched it to use resource_size() to do the calculation. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cpmac.c')
-rw-r--r--drivers/net/cpmac.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
index 3c58db595285..1756d28250d4 100644
--- a/drivers/net/cpmac.c
+++ b/drivers/net/cpmac.c
@@ -964,7 +964,7 @@ static int cpmac_open(struct net_device *dev)
964 struct sk_buff *skb; 964 struct sk_buff *skb;
965 965
966 mem = platform_get_resource_byname(priv->pdev, IORESOURCE_MEM, "regs"); 966 mem = platform_get_resource_byname(priv->pdev, IORESOURCE_MEM, "regs");
967 if (!request_mem_region(mem->start, mem->end - mem->start, dev->name)) { 967 if (!request_mem_region(mem->start, resource_size(mem), dev->name)) {
968 if (netif_msg_drv(priv)) 968 if (netif_msg_drv(priv))
969 printk(KERN_ERR "%s: failed to request registers\n", 969 printk(KERN_ERR "%s: failed to request registers\n",
970 dev->name); 970 dev->name);
@@ -972,7 +972,7 @@ static int cpmac_open(struct net_device *dev)
972 goto fail_reserve; 972 goto fail_reserve;
973 } 973 }
974 974
975 priv->regs = ioremap(mem->start, mem->end - mem->start); 975 priv->regs = ioremap(mem->start, resource_size(mem));
976 if (!priv->regs) { 976 if (!priv->regs) {
977 if (netif_msg_drv(priv)) 977 if (netif_msg_drv(priv))
978 printk(KERN_ERR "%s: failed to remap registers\n", 978 printk(KERN_ERR "%s: failed to remap registers\n",
@@ -1049,7 +1049,7 @@ fail_alloc:
1049 iounmap(priv->regs); 1049 iounmap(priv->regs);
1050 1050
1051fail_remap: 1051fail_remap:
1052 release_mem_region(mem->start, mem->end - mem->start); 1052 release_mem_region(mem->start, resource_size(mem));
1053 1053
1054fail_reserve: 1054fail_reserve:
1055 return res; 1055 return res;
@@ -1077,7 +1077,7 @@ static int cpmac_stop(struct net_device *dev)
1077 free_irq(dev->irq, dev); 1077 free_irq(dev->irq, dev);
1078 iounmap(priv->regs); 1078 iounmap(priv->regs);
1079 mem = platform_get_resource_byname(priv->pdev, IORESOURCE_MEM, "regs"); 1079 mem = platform_get_resource_byname(priv->pdev, IORESOURCE_MEM, "regs");
1080 release_mem_region(mem->start, mem->end - mem->start); 1080 release_mem_region(mem->start, resource_size(mem));
1081 priv->rx_head = &priv->desc_ring[CPMAC_QUEUES]; 1081 priv->rx_head = &priv->desc_ring[CPMAC_QUEUES];
1082 for (i = 0; i < priv->ring_size; i++) { 1082 for (i = 0; i < priv->ring_size; i++) {
1083 if (priv->rx_head[i].skb) { 1083 if (priv->rx_head[i].skb) {