Use resource_size() instead of explicit calculation. This was found via
make coccicheck.
Signed-off-by: Silviu-Mihai Popescu <[email protected]>
---
drivers/net/ethernet/nxp/lpc_eth.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index c4122c8..bc493c8 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1362,7 +1362,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
__lpc_eth_clock_enable(pldat, true);
/* Map IO space */
- pldat->net_base = ioremap(res->start, res->end - res->start + 1);
+ pldat->net_base = ioremap(res->start, resource_size(res));
if (!pldat->net_base) {
dev_err(&pdev->dev, "failed to map registers\n");
ret = -ENOMEM;
@@ -1421,7 +1421,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
netdev_dbg(ndev, "IO address start :0x%08x\n",
res->start);
netdev_dbg(ndev, "IO address size :%d\n",
- res->end - res->start + 1);
+ resource_size(res));
netdev_dbg(ndev, "IO address (mapped) :0x%p\n",
pldat->net_base);
netdev_dbg(ndev, "IRQ number :%d\n", ndev->irq);
--
1.7.9.5
On Tue, 2013-03-12 at 20:30 +0200, Silviu-Mihai Popescu wrote:
> Use resource_size() instead of explicit calculation. This was found via
> make coccicheck.
[]
> diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
[]
> @@ -1421,7 +1421,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
> netdev_dbg(ndev, "IO address start :0x%08x\n",
> res->start);
> netdev_dbg(ndev, "IO address size :%d\n",
> - res->end - res->start + 1);
> + resource_size(res));
This might be better as
netdev_dbg(ndev, "IO resource :%pR\n", res);
On Tue, Mar 12, 2013 at 9:10 PM, Joe Perches <[email protected]> wrote:
> On Tue, 2013-03-12 at 20:30 +0200, Silviu-Mihai Popescu wrote:
>> Use resource_size() instead of explicit calculation. This was found via
>> make coccicheck.
> []
>> diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
> []
>> @@ -1421,7 +1421,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
>> netdev_dbg(ndev, "IO address start :0x%08x\n",
>> res->start);
>> netdev_dbg(ndev, "IO address size :%d\n",
>> - res->end - res->start + 1);
>> + resource_size(res));
>
> This might be better as
>
> netdev_dbg(ndev, "IO resource :%pR\n", res);
>
>
Thanks for the review. I've refreshed the patch and sent it again.
--
Silviu Popescu