* [PATCH net-next v2 0/6] cleanup on resource check
@ 2014-10-23 1:58 Varka Bhadram
2014-10-23 1:58 ` [PATCH net-next v2 1/6] ethernet: wiznet: remove unnecessary check Varka Bhadram
` (5 more replies)
0 siblings, 6 replies; 10+ messages in thread
From: Varka Bhadram @ 2014-10-23 1:58 UTC (permalink / raw)
To: netdev; +Cc: davem, Varka Bhadram
This series removes the duplication of sanity check for
platform_get_resource() return resource. It will be checked
with devm_ioremap_resource()
changes since v1:
- remove NULL dereference on resource_size()
Varka Bhadram (6):
ethernet: wiznet: remove unnecessary check
ethernet: wiznet: remove unnecessary check
ethernet: apm: xgene: remove unnecessary check
ethernet: marvell: remove unnecessary check
ethernet: renesas: remove unnecessary check
ethernet: samsung: sxgbe: remove unnecessary check
drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 12 ------------
drivers/net/ethernet/marvell/pxa168_eth.c | 6 ++----
drivers/net/ethernet/renesas/sh_eth.c | 9 +++------
.../net/ethernet/samsung/sxgbe/sxgbe_platform.c | 3 ---
drivers/net/ethernet/wiznet/w5100.c | 6 ++----
drivers/net/ethernet/wiznet/w5300.c | 6 ++----
6 files changed, 9 insertions(+), 33 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH net-next v2 1/6] ethernet: wiznet: remove unnecessary check
2014-10-23 1:58 [PATCH net-next v2 0/6] cleanup on resource check Varka Bhadram
@ 2014-10-23 1:58 ` Varka Bhadram
2014-10-23 1:58 ` [PATCH net-next v2 2/6] " Varka Bhadram
` (4 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Varka Bhadram @ 2014-10-23 1:58 UTC (permalink / raw)
To: netdev; +Cc: davem, Varka Bhadram
devm_ioremap_resource checks platform_get_resource() return value.
We can remove the duplicate check here.
Signed-off-by: Varka Bhadram <varkab@cdac.in>
---
drivers/net/ethernet/wiznet/w5100.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c
index 0f56b1c..70a930a 100644
--- a/drivers/net/ethernet/wiznet/w5100.c
+++ b/drivers/net/ethernet/wiznet/w5100.c
@@ -638,14 +638,12 @@ static int w5100_hw_probe(struct platform_device *pdev)
}
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!mem)
- return -ENXIO;
- mem_size = resource_size(mem);
-
priv->base = devm_ioremap_resource(&pdev->dev, mem);
if (IS_ERR(priv->base))
return PTR_ERR(priv->base);
+ mem_size = resource_size(mem);
+
spin_lock_init(&priv->reg_lock);
priv->indirect = mem_size < W5100_BUS_DIRECT_SIZE;
if (priv->indirect) {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net-next v2 2/6] ethernet: wiznet: remove unnecessary check
2014-10-23 1:58 [PATCH net-next v2 0/6] cleanup on resource check Varka Bhadram
2014-10-23 1:58 ` [PATCH net-next v2 1/6] ethernet: wiznet: remove unnecessary check Varka Bhadram
@ 2014-10-23 1:58 ` Varka Bhadram
2014-10-23 12:23 ` Sergei Shtylyov
2014-10-23 1:58 ` [PATCH net-next v2 3/6] ethernet: apm: xgene: " Varka Bhadram
` (3 subsequent siblings)
5 siblings, 1 reply; 10+ messages in thread
From: Varka Bhadram @ 2014-10-23 1:58 UTC (permalink / raw)
To: netdev; +Cc: davem, Varka Bhadram
devm_ioremap_resource checks platform_get_resource() return value.
We can remove the duplicate check here.
Signed-off-by: Varka Bhadram <varkab@cdac.in>
---
drivers/net/ethernet/wiznet/w5300.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/wiznet/w5300.c b/drivers/net/ethernet/wiznet/w5300.c
index f961f14..7974b7d 100644
--- a/drivers/net/ethernet/wiznet/w5300.c
+++ b/drivers/net/ethernet/wiznet/w5300.c
@@ -558,14 +558,12 @@ static int w5300_hw_probe(struct platform_device *pdev)
}
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!mem)
- return -ENXIO;
- mem_size = resource_size(mem);
-
priv->base = devm_ioremap_resource(&pdev->dev, mem);
if (IS_ERR(priv->base))
return PTR_ERR(priv->base);
+ mem_size = resource_size(mem);
+
spin_lock_init(&priv->reg_lock);
priv->indirect = mem_size < W5300_BUS_DIRECT_SIZE;
if (priv->indirect) {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net-next v2 3/6] ethernet: apm: xgene: remove unnecessary check
2014-10-23 1:58 [PATCH net-next v2 0/6] cleanup on resource check Varka Bhadram
2014-10-23 1:58 ` [PATCH net-next v2 1/6] ethernet: wiznet: remove unnecessary check Varka Bhadram
2014-10-23 1:58 ` [PATCH net-next v2 2/6] " Varka Bhadram
@ 2014-10-23 1:58 ` Varka Bhadram
2014-10-23 1:58 ` [PATCH net-next v2 4/6] ethernet: marvell: " Varka Bhadram
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Varka Bhadram @ 2014-10-23 1:58 UTC (permalink / raw)
To: netdev; +Cc: davem, Varka Bhadram
devm_ioremap_resource checks platform_get_resource() return value.
We can remove the duplicate check here.
Signed-off-by: Varka Bhadram <varkab@cdac.in>
---
drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 3c208cc..f226594 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -761,10 +761,6 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
ndev = pdata->ndev;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "enet_csr");
- if (!res) {
- dev_err(dev, "Resource enet_csr not defined\n");
- return -ENODEV;
- }
pdata->base_addr = devm_ioremap_resource(dev, res);
if (IS_ERR(pdata->base_addr)) {
dev_err(dev, "Unable to retrieve ENET Port CSR region\n");
@@ -772,10 +768,6 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
}
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ring_csr");
- if (!res) {
- dev_err(dev, "Resource ring_csr not defined\n");
- return -ENODEV;
- }
pdata->ring_csr_addr = devm_ioremap_resource(dev, res);
if (IS_ERR(pdata->ring_csr_addr)) {
dev_err(dev, "Unable to retrieve ENET Ring CSR region\n");
@@ -783,10 +775,6 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
}
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ring_cmd");
- if (!res) {
- dev_err(dev, "Resource ring_cmd not defined\n");
- return -ENODEV;
- }
pdata->ring_cmd_addr = devm_ioremap_resource(dev, res);
if (IS_ERR(pdata->ring_cmd_addr)) {
dev_err(dev, "Unable to retrieve ENET Ring command region\n");
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net-next v2 4/6] ethernet: marvell: remove unnecessary check
2014-10-23 1:58 [PATCH net-next v2 0/6] cleanup on resource check Varka Bhadram
` (2 preceding siblings ...)
2014-10-23 1:58 ` [PATCH net-next v2 3/6] ethernet: apm: xgene: " Varka Bhadram
@ 2014-10-23 1:58 ` Varka Bhadram
2014-10-23 1:58 ` [PATCH net-next v2 5/6] ethernet: renesas: " Varka Bhadram
2014-10-23 1:58 ` [PATCH net-next v2 6/6] ethernet: samsung: sxgbe: " Varka Bhadram
5 siblings, 0 replies; 10+ messages in thread
From: Varka Bhadram @ 2014-10-23 1:58 UTC (permalink / raw)
To: netdev; +Cc: davem, Varka Bhadram
devm_ioremap_resource checks platform_get_resource() return value.
We can remove the duplicate check here.
Signed-off-by: Varka Bhadram <varkab@cdac.in>
---
drivers/net/ethernet/marvell/pxa168_eth.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index c3b209c..a378c92 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -1505,16 +1505,14 @@ static int pxa168_eth_probe(struct platform_device *pdev)
pep = netdev_priv(dev);
pep->dev = dev;
pep->clk = clk;
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (res == NULL) {
- err = -ENODEV;
- goto err_netdev;
- }
pep->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pep->base)) {
err = -ENOMEM;
goto err_netdev;
}
+
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
BUG_ON(!res);
dev->irq = res->start;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net-next v2 5/6] ethernet: renesas: remove unnecessary check
2014-10-23 1:58 [PATCH net-next v2 0/6] cleanup on resource check Varka Bhadram
` (3 preceding siblings ...)
2014-10-23 1:58 ` [PATCH net-next v2 4/6] ethernet: marvell: " Varka Bhadram
@ 2014-10-23 1:58 ` Varka Bhadram
2014-10-23 12:29 ` Sergei Shtylyov
2014-10-23 1:58 ` [PATCH net-next v2 6/6] ethernet: samsung: sxgbe: " Varka Bhadram
5 siblings, 1 reply; 10+ messages in thread
From: Varka Bhadram @ 2014-10-23 1:58 UTC (permalink / raw)
To: netdev; +Cc: davem, Varka Bhadram
devm_ioremap_resource checks platform_get_resource() return value.
We can remove the duplicate check here.
Signed-off-by: Varka Bhadram <varkab@cdac.in>
---
drivers/net/ethernet/renesas/sh_eth.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 60e9c2c..ffb49f3 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -2769,10 +2769,6 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
/* get base addr */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (unlikely(res == NULL)) {
- dev_err(&pdev->dev, "invalid resource\n");
- return -EINVAL;
- }
ndev = alloc_etherdev(sizeof(struct sh_eth_private));
if (!ndev)
@@ -2781,8 +2777,6 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev);
pm_runtime_get_sync(&pdev->dev);
- /* The sh Ether-specific entries in the device structure. */
- ndev->base_addr = res->start;
devno = pdev->id;
if (devno < 0)
devno = 0;
@@ -2806,6 +2800,9 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
goto out_release;
}
+ /* The sh Ether-specific entries in the device structure. */
+ ndev->base_addr = res->start;
+
spin_lock_init(&mdp->lock);
mdp->pdev = pdev;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net-next v2 6/6] ethernet: samsung: sxgbe: remove unnecessary check
2014-10-23 1:58 [PATCH net-next v2 0/6] cleanup on resource check Varka Bhadram
` (4 preceding siblings ...)
2014-10-23 1:58 ` [PATCH net-next v2 5/6] ethernet: renesas: " Varka Bhadram
@ 2014-10-23 1:58 ` Varka Bhadram
5 siblings, 0 replies; 10+ messages in thread
From: Varka Bhadram @ 2014-10-23 1:58 UTC (permalink / raw)
To: netdev; +Cc: davem, Varka Bhadram
devm_ioremap_resource checks platform_get_resource() return value.
We can remove the duplicate check here.
Signed-off-by: Varka Bhadram <varkab@cdac.in>
---
.../net/ethernet/samsung/sxgbe/sxgbe_platform.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
index b147d46..7fd6e27 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
@@ -90,9 +90,6 @@ static int sxgbe_platform_probe(struct platform_device *pdev)
/* Get memory resource */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- goto err_out;
-
addr = devm_ioremap_resource(dev, res);
if (IS_ERR(addr))
return PTR_ERR(addr);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH net-next v2 2/6] ethernet: wiznet: remove unnecessary check
2014-10-23 1:58 ` [PATCH net-next v2 2/6] " Varka Bhadram
@ 2014-10-23 12:23 ` Sergei Shtylyov
0 siblings, 0 replies; 10+ messages in thread
From: Sergei Shtylyov @ 2014-10-23 12:23 UTC (permalink / raw)
To: Varka Bhadram, netdev; +Cc: davem, Varka Bhadram
Hello.
On 10/23/2014 5:58 AM, Varka Bhadram wrote:
> devm_ioremap_resource checks platform_get_resource() return value.
> We can remove the duplicate check here.
> Signed-off-by: Varka Bhadram <varkab@cdac.in>
> ---
> drivers/net/ethernet/wiznet/w5300.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
Don't do 2 patches with the same subject. Either merge them, or include
the driver name (which is different in both cases) in the subject.
WBR, Sergei
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next v2 5/6] ethernet: renesas: remove unnecessary check
2014-10-23 1:58 ` [PATCH net-next v2 5/6] ethernet: renesas: " Varka Bhadram
@ 2014-10-23 12:29 ` Sergei Shtylyov
2014-10-24 2:15 ` Varka Bhadram
0 siblings, 1 reply; 10+ messages in thread
From: Sergei Shtylyov @ 2014-10-23 12:29 UTC (permalink / raw)
To: Varka Bhadram, netdev; +Cc: davem, Varka Bhadram
On 10/23/2014 5:58 AM, Varka Bhadram wrote:
> devm_ioremap_resource checks platform_get_resource() return value.
> We can remove the duplicate check here.
> Signed-off-by: Varka Bhadram <varkab@cdac.in>
> ---
> drivers/net/ethernet/renesas/sh_eth.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
> index 60e9c2c..ffb49f3 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
[...]
> @@ -2781,8 +2777,6 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
> pm_runtime_enable(&pdev->dev);
> pm_runtime_get_sync(&pdev->dev);
>
> - /* The sh Ether-specific entries in the device structure. */
> - ndev->base_addr = res->start;
> devno = pdev->id;
> if (devno < 0)
> devno = 0;
> @@ -2806,6 +2800,9 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
> goto out_release;
> }
>
> + /* The sh Ether-specific entries in the device structure. */
No need to move the comment, at least not there.
> + ndev->base_addr = res->start;
> +
> spin_lock_init(&mdp->lock);
> mdp->pdev = pdev;
WBR, Sergei
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next v2 5/6] ethernet: renesas: remove unnecessary check
2014-10-23 12:29 ` Sergei Shtylyov
@ 2014-10-24 2:15 ` Varka Bhadram
0 siblings, 0 replies; 10+ messages in thread
From: Varka Bhadram @ 2014-10-24 2:15 UTC (permalink / raw)
To: Sergei Shtylyov, netdev; +Cc: davem, Varka Bhadram
On Thursday 23 October 2014 05:59 PM, Sergei Shtylyov wrote:
> On 10/23/2014 5:58 AM, Varka Bhadram wrote:
>
>> devm_ioremap_resource checks platform_get_resource() return value.
>> We can remove the duplicate check here.
>
>> Signed-off-by: Varka Bhadram <varkab@cdac.in>
>> ---
>> drivers/net/ethernet/renesas/sh_eth.c | 9 +++------
>> 1 file changed, 3 insertions(+), 6 deletions(-)
>
>> diff --git a/drivers/net/ethernet/renesas/sh_eth.c
>> b/drivers/net/ethernet/renesas/sh_eth.c
>> index 60e9c2c..ffb49f3 100644
>> --- a/drivers/net/ethernet/renesas/sh_eth.c
>> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> [...]
>> @@ -2781,8 +2777,6 @@ static int sh_eth_drv_probe(struct
>> platform_device *pdev)
>> pm_runtime_enable(&pdev->dev);
>> pm_runtime_get_sync(&pdev->dev);
>>
>> - /* The sh Ether-specific entries in the device structure. */
>> - ndev->base_addr = res->start;
>> devno = pdev->id;
>> if (devno < 0)
>> devno = 0;
>> @@ -2806,6 +2800,9 @@ static int sh_eth_drv_probe(struct
>> platform_device *pdev)
>> goto out_release;
>> }
>>
>> + /* The sh Ether-specific entries in the device structure. */
>
> No need to move the comment, at least not there.
>
>> + ndev->base_addr = res->start;
>> +
>> spin_lock_init(&mdp->lock);
>> mdp->pdev = pdev;
>
> WBR, Sergei
>
thanks for the review. In v3 i will address these issues.
--
Thanks and Regards,
Varka Bhadram.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2014-10-24 2:15 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-23 1:58 [PATCH net-next v2 0/6] cleanup on resource check Varka Bhadram
2014-10-23 1:58 ` [PATCH net-next v2 1/6] ethernet: wiznet: remove unnecessary check Varka Bhadram
2014-10-23 1:58 ` [PATCH net-next v2 2/6] " Varka Bhadram
2014-10-23 12:23 ` Sergei Shtylyov
2014-10-23 1:58 ` [PATCH net-next v2 3/6] ethernet: apm: xgene: " Varka Bhadram
2014-10-23 1:58 ` [PATCH net-next v2 4/6] ethernet: marvell: " Varka Bhadram
2014-10-23 1:58 ` [PATCH net-next v2 5/6] ethernet: renesas: " Varka Bhadram
2014-10-23 12:29 ` Sergei Shtylyov
2014-10-24 2:15 ` Varka Bhadram
2014-10-23 1:58 ` [PATCH net-next v2 6/6] ethernet: samsung: sxgbe: " Varka Bhadram
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).