korina: use resource_size()
authorDan Carpenter <error27@gmail.com>
Mon, 22 Mar 2010 02:11:45 +0000 (02:11 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 23 Mar 2010 01:33:11 +0000 (18:33 -0700)
This size calculation is wrong.  It should be end - start + 1.
Use resource_size() to calculate it correctly.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/korina.c

index 300c2249812d7a89df044d99aa2a6c15f5a874c0..edaedc7aa03ffd034483039e20caa8e817e4c73e 100644 (file)
@@ -1135,7 +1135,7 @@ static int korina_probe(struct platform_device *pdev)
 
        r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "korina_regs");
        dev->base_addr = r->start;
-       lp->eth_regs = ioremap_nocache(r->start, r->end - r->start);
+       lp->eth_regs = ioremap_nocache(r->start, resource_size(r));
        if (!lp->eth_regs) {
                printk(KERN_ERR DRV_NAME ": cannot remap registers\n");
                rc = -ENXIO;
@@ -1143,7 +1143,7 @@ static int korina_probe(struct platform_device *pdev)
        }
 
        r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "korina_dma_rx");
-       lp->rx_dma_regs = ioremap_nocache(r->start, r->end - r->start);
+       lp->rx_dma_regs = ioremap_nocache(r->start, resource_size(r));
        if (!lp->rx_dma_regs) {
                printk(KERN_ERR DRV_NAME ": cannot remap Rx DMA registers\n");
                rc = -ENXIO;
@@ -1151,7 +1151,7 @@ static int korina_probe(struct platform_device *pdev)
        }
 
        r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "korina_dma_tx");
-       lp->tx_dma_regs = ioremap_nocache(r->start, r->end - r->start);
+       lp->tx_dma_regs = ioremap_nocache(r->start, resource_size(r));
        if (!lp->tx_dma_regs) {
                printk(KERN_ERR DRV_NAME ": cannot remap Tx DMA registers\n");
                rc = -ENXIO;