net: emaclite: Use resource_size
authorTobias Klauser <tklauser@distanz.ch>
Wed, 5 May 2010 22:12:20 +0000 (22:12 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 6 May 2010 08:31:29 +0000 (01:31 -0700)
Use the resource_size function instead of manually calculating the
resource size.  This reduces the chance of introducing off-by-one
errors.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/xilinx_emaclite.c

index e9381fe3baf475c914c3690bae7cfecedaff133c..93828d565390f6dcfb61860fa1811f526eaf48ad 100644 (file)
@@ -1171,7 +1171,7 @@ static int __devinit xemaclite_of_probe(struct of_device *ofdev,
        }
 
        /* Get the virtual base address for the device */
-       lp->base_addr = ioremap(r_mem.start, r_mem.end - r_mem.start + 1);
+       lp->base_addr = ioremap(r_mem.start, resource_size(&r_mem));
        if (NULL == lp->base_addr) {
                dev_err(dev, "EmacLite: Could not allocate iomem\n");
                rc = -EIO;
@@ -1224,7 +1224,7 @@ static int __devinit xemaclite_of_probe(struct of_device *ofdev,
        return 0;
 
 error1:
-       release_mem_region(ndev->mem_start, r_mem.end - r_mem.start + 1);
+       release_mem_region(ndev->mem_start, resource_size(&r_mem));
 
 error2:
        xemaclite_remove_ndev(ndev);