diff mbox

[net-next,v2,5/6] ethernet: renesas: remove unnecessary check

Message ID 1414029531-5067-6-git-send-email-varkab@cdac.in
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Varka Bhadram Oct. 23, 2014, 1:58 a.m. UTC
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(-)

Comments

Sergei Shtylyov Oct. 23, 2014, 12:29 p.m. UTC | #1
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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Varka Bhadram Oct. 24, 2014, 2:15 a.m. UTC | #2
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.
diff mbox

Patch

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;