2014-06-02 02:27:09

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 2/2] lpc_eth: Use resource_size instead of computation

From: Benoit Taine <[email protected]>
Date: Wed, 28 May 2014 17:14:07 +0200

> @@ -1419,8 +1419,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);
> + netdev_dbg(ndev, "IO address size :%d\n", resource_size(res));
> netdev_dbg(ndev, "IO address (mapped) :0x%p\n",
> pldat->net_base);

Please replace all of this with %pR as suggested by Joe, thanks.


2014-06-02 11:23:25

by Benoit Taine

[permalink] [raw]
Subject: [PATCH 2/2 v2] lpc_eth: Use resource_size instead of computation

This issue was reported by coccicheck using the semantic patch
at scripts/coccinelle/api/resource_size.cocci

Signed-off-by: Benoit Taine <[email protected]>
---
Not compile tested, due incompatible architecture.

diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 422d9b5..645dac3 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1361,7 +1361,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;
@@ -1417,10 +1417,8 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
}
pldat->dma_buff_base_p = dma_handle;

- netdev_dbg(ndev, "IO address start :0x%08x\n",
- res->start);
- netdev_dbg(ndev, "IO address size :%d\n",
- res->end - res->start + 1);
+ netdev_dbg(ndev, "IO address space :%pR", res);
+ netdev_dbg(ndev, "IO address size :%d\n", resource_size(res));
netdev_dbg(ndev, "IO address (mapped) :0x%p\n",
pldat->net_base);
netdev_dbg(ndev, "IRQ number :%d\n", ndev->irq);

2014-06-02 11:33:39

by Benoit Taine

[permalink] [raw]
Subject: Re: [PATCH 2/2 v3] lpc_eth: Use resource_size instead of computation

This issue was reported by coccicheck using the semantic patch
at scripts/coccinelle/api/resource_size.cocci

Signed-off-by: Benoit Taine <[email protected]>
---
Not compile tested, due incompatible architecture.

Changes from V2:
- added line break to debug message

Changes from V1:
- Use %pR format type with the debug message (Thanks to Joe Perches)

diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 422d9b5..645dac3 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1361,7 +1361,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;
@@ -1417,10 +1417,8 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
}
pldat->dma_buff_base_p = dma_handle;

- netdev_dbg(ndev, "IO address start :0x%08x\n",
- res->start);
- netdev_dbg(ndev, "IO address size :%d\n",
- res->end - res->start + 1);
+ netdev_dbg(ndev, "IO address space :%pR\n", res);
+ netdev_dbg(ndev, "IO address size :%d\n", resource_size(res));
netdev_dbg(ndev, "IO address (mapped) :0x%p\n",
pldat->net_base);
netdev_dbg(ndev, "IRQ number :%d\n", ndev->irq);

2014-06-02 17:59:02

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 2/2 v3] lpc_eth: Use resource_size instead of computation

From: Benoit Taine <[email protected]>
Date: Mon, 2 Jun 2014 13:34:30 +0200

> This issue was reported by coccicheck using the semantic patch
> at scripts/coccinelle/api/resource_size.cocci
>
> Signed-off-by: Benoit Taine <[email protected]>

This patch doesn't apply cleanly to any of my trees.

2014-06-03 10:32:01

by Benoit Taine

[permalink] [raw]
Subject: [PATCH 2/2 v4] lpc_eth: Use resource_size instead of computation

This issue was reported by coccicheck using the semantic patch
at scripts/coccinelle/api/resource_size.cocci

Signed-off-by: Benoit Taine <[email protected]>
---
Not compile tested, due incompatible architecture.

Changes from V3:
- should now apply correctly

Changes from V2:
- added line break to debug message

Changes from V1:
- Use %pR format type with the debug message (Thanks to Joe Perches)

diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 422d9b5..8706c0d 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1361,7 +1361,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;
@@ -1417,10 +1417,8 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
}
pldat->dma_buff_base_p = dma_handle;

- netdev_dbg(ndev, "IO address start :0x%08x\n",
- res->start);
- netdev_dbg(ndev, "IO address size :%d\n",
- res->end - res->start + 1);
+ netdev_dbg(ndev, "IO address space :%pR\n", res);
+ netdev_dbg(ndev, "IO address size :%d\n", resource_size(res));
netdev_dbg(ndev, "IO address (mapped) :0x%p\n",
pldat->net_base);
netdev_dbg(ndev, "IRQ number :%d\n", ndev->irq);

2014-06-03 10:45:05

by Benoit Taine

[permalink] [raw]
Subject: [PATCH 2/2 v5] lpc_eth: Use resource_size instead of computation

This issue was reported by coccicheck using the semantic patch
at scripts/coccinelle/api/resource_size.cocci

Signed-off-by: Benoit Taine <[email protected]>
---
Not compile tested, due incompatible architecture.

Changes from V4:
- Added blank line a the end of the diff (Thank to David Miller for your
patience)

Changes from V3:
- should now apply correctly

Changes from V2:
- added line break to debug message

Changes from V1:
- Use %pR format type with the debug message (Thanks to Joe Perches)

diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 422d9b5..8706c0d 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1361,7 +1361,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;
@@ -1417,10 +1417,8 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
}
pldat->dma_buff_base_p = dma_handle;

- netdev_dbg(ndev, "IO address start :0x%08x\n",
- res->start);
- netdev_dbg(ndev, "IO address size :%d\n",
- res->end - res->start + 1);
+ netdev_dbg(ndev, "IO address space :%pR\n", res);
+ netdev_dbg(ndev, "IO address size :%d\n", resource_size(res));
netdev_dbg(ndev, "IO address (mapped) :0x%p\n",
pldat->net_base);
netdev_dbg(ndev, "IRQ number :%d\n", ndev->irq);

2014-06-03 23:09:17

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 2/2 v5] lpc_eth: Use resource_size instead of computation

From: Benoit Taine <[email protected]>
Date: Tue, 3 Jun 2014 12:45:59 +0200

> This issue was reported by coccicheck using the semantic patch
> at scripts/coccinelle/api/resource_size.cocci
>
> Signed-off-by: Benoit Taine <[email protected]>

Applied, thanks.