diff mbox series

[3/5] drm/msm: Fix IS_ERR_OR_NULL() vs NULL check in msm_icc_get()

Message ID 20221110094445.2930509-4-cuigaosheng1@huawei.com (mailing list archive)
State Not Applicable
Headers show
Series Fix IS_ERR() vs NULL check for drm | expand

Commit Message

cuigaosheng Nov. 10, 2022, 9:44 a.m. UTC
The of_icc_get() function returns NULL or error pointers on error path,
so we should use IS_ERR_OR_NULL() to check the return value.

Fixes: 5ccdcecaf8f7 ("drm/msm: lookup the ICC paths in both mdp5/dpu and mdss devices")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
---
 drivers/gpu/drm/msm/msm_io_utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marijn Suijten Nov. 11, 2022, 10:02 a.m. UTC | #1
On 2022-11-10 17:44:43, Gaosheng Cui wrote:
> The of_icc_get() function returns NULL or error pointers on error path,
> so we should use IS_ERR_OR_NULL() to check the return value.
> 
> Fixes: 5ccdcecaf8f7 ("drm/msm: lookup the ICC paths in both mdp5/dpu and mdss devices")
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> ---
>  drivers/gpu/drm/msm/msm_io_utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/msm_io_utils.c b/drivers/gpu/drm/msm/msm_io_utils.c
> index d02cd29ce829..950083b2f092 100644
> --- a/drivers/gpu/drm/msm/msm_io_utils.c
> +++ b/drivers/gpu/drm/msm/msm_io_utils.c
> @@ -133,7 +133,7 @@ struct icc_path *msm_icc_get(struct device *dev, const char *name)
>  	struct icc_path *path;
>  
>  	path = of_icc_get(dev, name);
> -	if (path)
> +	if (IS_ERR_OR_NULL(path))

NAK. This path should be returned if it is NON-NULL, otherwise we defer
to of_icc_get() on the parent device.  See the code-comment below.

- Marijn

>  		return path;
>  
>  	/*
> -- 
> 2.25.1
>
cuigaosheng Nov. 12, 2022, 6:50 a.m. UTC | #2
> NAK. This path should be returned if it is NON-NULL, otherwise we defer
> to of_icc_get() on the parent device.  See the code-comment below.

Thanks for taking time to review this patch, how do you think of the following changes:
  
> diff --git a/drivers/gpu/drm/msm/msm_io_utils.c 
> b/drivers/gpu/drm/msm/msm_io_utils.c index d02cd29ce829..a112d8c74d59 
> 100644 --- a/drivers/gpu/drm/msm/msm_io_utils.c +++ 
> b/drivers/gpu/drm/msm/msm_io_utils.c @@ -133,7 +133,7 @@ struct 
> icc_path *msm_icc_get(struct device *dev, const char *name) struct 
> icc_path *path; path = of_icc_get(dev, name); - if (path) + if 
> (!IS_ERR_OR_NULL(path)) return path; 

Looking forward to your reply, thanks again!

On 2022/11/11 18:02, Marijn Suijten wrote:
> On 2022-11-10 17:44:43, Gaosheng Cui wrote:
>> The of_icc_get() function returns NULL or error pointers on error path,
>> so we should use IS_ERR_OR_NULL() to check the return value.
>>
>> Fixes: 5ccdcecaf8f7 ("drm/msm: lookup the ICC paths in both mdp5/dpu and mdss devices")
>> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
>> ---
>>   drivers/gpu/drm/msm/msm_io_utils.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/msm/msm_io_utils.c b/drivers/gpu/drm/msm/msm_io_utils.c
>> index d02cd29ce829..950083b2f092 100644
>> --- a/drivers/gpu/drm/msm/msm_io_utils.c
>> +++ b/drivers/gpu/drm/msm/msm_io_utils.c
>> @@ -133,7 +133,7 @@ struct icc_path *msm_icc_get(struct device *dev, const char *name)
>>   	struct icc_path *path;
>>   
>>   	path = of_icc_get(dev, name);
>> -	if (path)
>> +	if (IS_ERR_OR_NULL(path))
> NAK. This path should be returned if it is NON-NULL, otherwise we defer
> to of_icc_get() on the parent device.  See the code-comment below.
>
> - Marijn
>
>>   		return path;
>>   
>>   	/*
>> -- 
>> 2.25.1
>>
> .
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/msm_io_utils.c b/drivers/gpu/drm/msm/msm_io_utils.c
index d02cd29ce829..950083b2f092 100644
--- a/drivers/gpu/drm/msm/msm_io_utils.c
+++ b/drivers/gpu/drm/msm/msm_io_utils.c
@@ -133,7 +133,7 @@  struct icc_path *msm_icc_get(struct device *dev, const char *name)
 	struct icc_path *path;
 
 	path = of_icc_get(dev, name);
-	if (path)
+	if (IS_ERR_OR_NULL(path))
 		return path;
 
 	/*