提交 575400bf 编写于 作者: T Tobias Klauser 提交者: David S. Miller

net: emaclite: Use resource_size

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: NTobias Klauser <tklauser@distanz.ch>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 627c8a04
...@@ -1171,7 +1171,7 @@ static int __devinit xemaclite_of_probe(struct of_device *ofdev, ...@@ -1171,7 +1171,7 @@ static int __devinit xemaclite_of_probe(struct of_device *ofdev,
} }
/* Get the virtual base address for the device */ /* 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) { if (NULL == lp->base_addr) {
dev_err(dev, "EmacLite: Could not allocate iomem\n"); dev_err(dev, "EmacLite: Could not allocate iomem\n");
rc = -EIO; rc = -EIO;
...@@ -1224,7 +1224,7 @@ static int __devinit xemaclite_of_probe(struct of_device *ofdev, ...@@ -1224,7 +1224,7 @@ static int __devinit xemaclite_of_probe(struct of_device *ofdev,
return 0; return 0;
error1: 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: error2:
xemaclite_remove_ndev(ndev); xemaclite_remove_ndev(ndev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册