diff mbox series

[v2,net-next] net: ethernet: ti: cpsw: Fix inconsistent IS_ERR and PTR_ERR in cpsw_probe()

Message ID 20190429143157.79035-1-yuehaibing@huawei.com (mailing list archive)
State New, archived
Headers show
Series [v2,net-next] net: ethernet: ti: cpsw: Fix inconsistent IS_ERR and PTR_ERR in cpsw_probe() | expand

Commit Message

Yue Haibing April 29, 2019, 2:31 p.m. UTC
Change the call to PTR_ERR to access the value just tested by IS_ERR.

Fixes: 83a8471ba255 ("net: ethernet: ti: cpsw: refactor probe to group common hw initialization")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
v2: add Fixes tag
---
 drivers/net/ethernet/ti/cpsw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Julia Lawall April 29, 2019, 4:30 p.m. UTC | #1
On Mon, 29 Apr 2019, YueHaibing wrote:

> Change the call to PTR_ERR to access the value just tested by IS_ERR.

I assume you didn't find the problem just looking through the code by
hand.  If you used a tool, it would be really good to acknowledge the tool
that was used.  The tools don't come for free, and you don't pay for them.
The only payment that you can offer is to acknowledge that the tool was
used, which helps justify that the tool is useful and what it is useful
for.

julia

>
> Fixes: 83a8471ba255 ("net: ethernet: ti: cpsw: refactor probe to group common hw initialization")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> ---
> v2: add Fixes tag
> ---
>  drivers/net/ethernet/ti/cpsw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
> index c3cba46fac9d..e37680654a13 100644
> --- a/drivers/net/ethernet/ti/cpsw.c
> +++ b/drivers/net/ethernet/ti/cpsw.c
> @@ -2381,7 +2381,7 @@ static int cpsw_probe(struct platform_device *pdev)
>
>  	clk = devm_clk_get(dev, "fck");
>  	if (IS_ERR(clk)) {
> -		ret = PTR_ERR(mode);
> +		ret = PTR_ERR(clk);
>  		dev_err(dev, "fck is not found %d\n", ret);
>  		return ret;
>  	}
>
>
>
>
Yue Haibing April 30, 2019, 1:33 a.m. UTC | #2
On 2019/4/30 0:30, Julia Lawall wrote:
> 
> 
> On Mon, 29 Apr 2019, YueHaibing wrote:
> 
>> Change the call to PTR_ERR to access the value just tested by IS_ERR.
> 
> I assume you didn't find the problem just looking through the code by
> hand.  If you used a tool, it would be really good to acknowledge the tool
> that was used.  The tools don't come for free, and you don't pay for them.
> The only payment that you can offer is to acknowledge that the tool was
> used, which helps justify that the tool is useful and what it is useful
> for.

Sorry, I forgot edit the commit log and add this info.

It was detected by Coccinelle, I will add this and resend.

> 
> julia
> 
>>
>> Fixes: 83a8471ba255 ("net: ethernet: ti: cpsw: refactor probe to group common hw initialization")
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
>> ---
>> v2: add Fixes tag
>> ---
>>  drivers/net/ethernet/ti/cpsw.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
>> index c3cba46fac9d..e37680654a13 100644
>> --- a/drivers/net/ethernet/ti/cpsw.c
>> +++ b/drivers/net/ethernet/ti/cpsw.c
>> @@ -2381,7 +2381,7 @@ static int cpsw_probe(struct platform_device *pdev)
>>
>>  	clk = devm_clk_get(dev, "fck");
>>  	if (IS_ERR(clk)) {
>> -		ret = PTR_ERR(mode);
>> +		ret = PTR_ERR(clk);
>>  		dev_err(dev, "fck is not found %d\n", ret);
>>  		return ret;
>>  	}
>>
>>
>>
>>
> 
> .
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index c3cba46fac9d..e37680654a13 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -2381,7 +2381,7 @@  static int cpsw_probe(struct platform_device *pdev)
 
 	clk = devm_clk_get(dev, "fck");
 	if (IS_ERR(clk)) {
-		ret = PTR_ERR(mode);
+		ret = PTR_ERR(clk);
 		dev_err(dev, "fck is not found %d\n", ret);
 		return ret;
 	}