diff mbox series

PM / devfreq: imx: Fix inconsistent IS_ERR and PTR_ERR

Message ID 20200507131245.GA709@embeddedor (mailing list archive)
State Accepted
Delegated to: Chanwoo Choi
Headers show
Series PM / devfreq: imx: Fix inconsistent IS_ERR and PTR_ERR | expand

Commit Message

Gustavo A. R. Silva May 7, 2020, 1:12 p.m. UTC
Fix inconsistent IS_ERR and PTR_ERR in imx_bus_init_icc().

The proper pointer to be passed as argument to PTR_ERR() is
priv->icc_pdev.

This bug was detected with the help of Coccinelle.

Fixes: 16c1d2f1b0bd ("PM / devfreq: imx: Register interconnect device")
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 drivers/devfreq/imx-bus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Aisheng Dong May 7, 2020, 1:27 p.m. UTC | #1
> From: Gustavo A. R. Silva <gustavoars@kernel.org>
> Sent: Thursday, May 7, 2020 9:13 PM
> 
> Fix inconsistent IS_ERR and PTR_ERR in imx_bus_init_icc().
> 
> The proper pointer to be passed as argument to PTR_ERR() is
> priv->icc_pdev.
> 
> This bug was detected with the help of Coccinelle.
> 
> Fixes: 16c1d2f1b0bd ("PM / devfreq: imx: Register interconnect device")
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks for the fix.
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>

Regards
Aisheng

> ---
>  drivers/devfreq/imx-bus.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/devfreq/imx-bus.c b/drivers/devfreq/imx-bus.c index
> 532e7954032f..4f38455ad742 100644
> --- a/drivers/devfreq/imx-bus.c
> +++ b/drivers/devfreq/imx-bus.c
> @@ -88,8 +88,8 @@ static int imx_bus_init_icc(struct device *dev)
>  			dev, icc_driver_name, -1, NULL, 0);
>  	if (IS_ERR(priv->icc_pdev)) {
>  		dev_err(dev, "failed to register icc provider %s: %ld\n",
> -				icc_driver_name, PTR_ERR(priv->devfreq));
> -		return PTR_ERR(priv->devfreq);
> +				icc_driver_name, PTR_ERR(priv->icc_pdev));
> +		return PTR_ERR(priv->icc_pdev);
>  	}
> 
>  	return 0;
> --
> 2.26.2
Chanwoo Choi May 8, 2020, 3:55 a.m. UTC | #2
On 5/7/20 10:12 PM, Gustavo A. R. Silva wrote:
> Fix inconsistent IS_ERR and PTR_ERR in imx_bus_init_icc().
> 
> The proper pointer to be passed as argument to PTR_ERR() is
> priv->icc_pdev.
> 
> This bug was detected with the help of Coccinelle.
> 
> Fixes: 16c1d2f1b0bd ("PM / devfreq: imx: Register interconnect device")
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
>  drivers/devfreq/imx-bus.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/devfreq/imx-bus.c b/drivers/devfreq/imx-bus.c
> index 532e7954032f..4f38455ad742 100644
> --- a/drivers/devfreq/imx-bus.c
> +++ b/drivers/devfreq/imx-bus.c
> @@ -88,8 +88,8 @@ static int imx_bus_init_icc(struct device *dev)
>  			dev, icc_driver_name, -1, NULL, 0);
>  	if (IS_ERR(priv->icc_pdev)) {
>  		dev_err(dev, "failed to register icc provider %s: %ld\n",
> -				icc_driver_name, PTR_ERR(priv->devfreq));
> -		return PTR_ERR(priv->devfreq);
> +				icc_driver_name, PTR_ERR(priv->icc_pdev));
> +		return PTR_ERR(priv->icc_pdev);
>  	}
>  
>  	return 0;
> 

Applied it. Thanks.
Chanwoo Choi May 8, 2020, 3:57 a.m. UTC | #3
On 5/8/20 12:55 PM, Chanwoo Choi wrote:
> On 5/7/20 10:12 PM, Gustavo A. R. Silva wrote:
>> Fix inconsistent IS_ERR and PTR_ERR in imx_bus_init_icc().
>>
>> The proper pointer to be passed as argument to PTR_ERR() is
>> priv->icc_pdev.
>>
>> This bug was detected with the help of Coccinelle.
>>
>> Fixes: 16c1d2f1b0bd ("PM / devfreq: imx: Register interconnect device")
>> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
>> ---
>>  drivers/devfreq/imx-bus.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/devfreq/imx-bus.c b/drivers/devfreq/imx-bus.c
>> index 532e7954032f..4f38455ad742 100644
>> --- a/drivers/devfreq/imx-bus.c
>> +++ b/drivers/devfreq/imx-bus.c
>> @@ -88,8 +88,8 @@ static int imx_bus_init_icc(struct device *dev)
>>  			dev, icc_driver_name, -1, NULL, 0);
>>  	if (IS_ERR(priv->icc_pdev)) {
>>  		dev_err(dev, "failed to register icc provider %s: %ld\n",
>> -				icc_driver_name, PTR_ERR(priv->devfreq));
>> -		return PTR_ERR(priv->devfreq);
>> +				icc_driver_name, PTR_ERR(priv->icc_pdev));
>> +		return PTR_ERR(priv->icc_pdev);
>>  	}
>>  
>>  	return 0;
>>
> 
> Applied it. Thanks.
> 

I edit the patch title as following:
- before : PM / devfreq: imx: Fix inconsistent IS_ERR and PTR_ERR
- after  : PM / devfreq: imx-bus: Fix inconsistent IS_ERR and PTR_ERR

Thanks.
diff mbox series

Patch

diff --git a/drivers/devfreq/imx-bus.c b/drivers/devfreq/imx-bus.c
index 532e7954032f..4f38455ad742 100644
--- a/drivers/devfreq/imx-bus.c
+++ b/drivers/devfreq/imx-bus.c
@@ -88,8 +88,8 @@  static int imx_bus_init_icc(struct device *dev)
 			dev, icc_driver_name, -1, NULL, 0);
 	if (IS_ERR(priv->icc_pdev)) {
 		dev_err(dev, "failed to register icc provider %s: %ld\n",
-				icc_driver_name, PTR_ERR(priv->devfreq));
-		return PTR_ERR(priv->devfreq);
+				icc_driver_name, PTR_ERR(priv->icc_pdev));
+		return PTR_ERR(priv->icc_pdev);
 	}
 
 	return 0;