All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: platform: mtk-mdp3: Fix return value check in mdp_probe()
@ 2022-11-30  8:13 ` Qiheng Lin
  0 siblings, 0 replies; 6+ messages in thread
From: Qiheng Lin @ 2022-11-30  8:13 UTC (permalink / raw)
  To: mchehab, matthias.bgg
  Cc: linux-media, linux-arm-kernel, linux-mediatek, linux-kernel, Qiheng Lin

In case of error, the function mtk_mutex_get()
returns ERR_PTR() and never returns NULL. The NULL test in the
return value check should be replaced with IS_ERR().

Fixes: 61890ccaefaf ("media: platform: mtk-mdp3: add MediaTek MDP3 driver")
Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
---
 drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
index c413e59d4286..7a2d992dd842 100644
--- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
+++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
@@ -207,8 +207,8 @@ static int mdp_probe(struct platform_device *pdev)
 	}
 	for (i = 0; i < MDP_PIPE_MAX; i++) {
 		mdp->mdp_mutex[i] = mtk_mutex_get(&mm_pdev->dev);
-		if (!mdp->mdp_mutex[i]) {
-			ret = -ENODEV;
+		if (IS_ERR(mdp->mdp_mutex[i])) {
+			ret = PTR_ERR(mdp->mdp_mutex[i]);
 			goto err_return;
 		}
 	}
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] media: platform: mtk-mdp3: Fix return value check in mdp_probe()
@ 2022-11-30  8:13 ` Qiheng Lin
  0 siblings, 0 replies; 6+ messages in thread
From: Qiheng Lin @ 2022-11-30  8:13 UTC (permalink / raw)
  To: mchehab, matthias.bgg
  Cc: linux-media, linux-arm-kernel, linux-mediatek, linux-kernel, Qiheng Lin

In case of error, the function mtk_mutex_get()
returns ERR_PTR() and never returns NULL. The NULL test in the
return value check should be replaced with IS_ERR().

Fixes: 61890ccaefaf ("media: platform: mtk-mdp3: add MediaTek MDP3 driver")
Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
---
 drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
index c413e59d4286..7a2d992dd842 100644
--- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
+++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
@@ -207,8 +207,8 @@ static int mdp_probe(struct platform_device *pdev)
 	}
 	for (i = 0; i < MDP_PIPE_MAX; i++) {
 		mdp->mdp_mutex[i] = mtk_mutex_get(&mm_pdev->dev);
-		if (!mdp->mdp_mutex[i]) {
-			ret = -ENODEV;
+		if (IS_ERR(mdp->mdp_mutex[i])) {
+			ret = PTR_ERR(mdp->mdp_mutex[i]);
 			goto err_return;
 		}
 	}
-- 
2.32.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] media: platform: mtk-mdp3: Fix return value check in mdp_probe()
  2022-11-30  8:13 ` Qiheng Lin
@ 2022-11-30  9:44   ` AngeloGioacchino Del Regno
  -1 siblings, 0 replies; 6+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-11-30  9:44 UTC (permalink / raw)
  To: Qiheng Lin, mchehab, matthias.bgg
  Cc: linux-media, linux-arm-kernel, linux-mediatek, linux-kernel

Il 30/11/22 09:13, Qiheng Lin ha scritto:
> In case of error, the function mtk_mutex_get()
> returns ERR_PTR() and never returns NULL. The NULL test in the
> return value check should be replaced with IS_ERR().
> 
> Fixes: 61890ccaefaf ("media: platform: mtk-mdp3: add MediaTek MDP3 driver")
> Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
> ---
>   drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
> index c413e59d4286..7a2d992dd842 100644
> --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
> +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
> @@ -207,8 +207,8 @@ static int mdp_probe(struct platform_device *pdev)
>   	}
>   	for (i = 0; i < MDP_PIPE_MAX; i++) {
>   		mdp->mdp_mutex[i] = mtk_mutex_get(&mm_pdev->dev);
> -		if (!mdp->mdp_mutex[i]) {
> -			ret = -ENODEV;
> +		if (IS_ERR(mdp->mdp_mutex[i])) {
> +			ret = PTR_ERR(mdp->mdp_mutex[i]);
>   			goto err_return;
>   		}
>   	}
> 

That's true, and I fully agree.
While you're at it, can you also fix the err_return case?

if (mdp)
	for ...
		if (!IS_ERR_OR_NULL(mdp->mdp_mutex[i]))
			mtk_mutex_put(...)


Thanks,
Angelo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] media: platform: mtk-mdp3: Fix return value check in mdp_probe()
@ 2022-11-30  9:44   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 6+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-11-30  9:44 UTC (permalink / raw)
  To: Qiheng Lin, mchehab, matthias.bgg
  Cc: linux-media, linux-arm-kernel, linux-mediatek, linux-kernel

Il 30/11/22 09:13, Qiheng Lin ha scritto:
> In case of error, the function mtk_mutex_get()
> returns ERR_PTR() and never returns NULL. The NULL test in the
> return value check should be replaced with IS_ERR().
> 
> Fixes: 61890ccaefaf ("media: platform: mtk-mdp3: add MediaTek MDP3 driver")
> Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
> ---
>   drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
> index c413e59d4286..7a2d992dd842 100644
> --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
> +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
> @@ -207,8 +207,8 @@ static int mdp_probe(struct platform_device *pdev)
>   	}
>   	for (i = 0; i < MDP_PIPE_MAX; i++) {
>   		mdp->mdp_mutex[i] = mtk_mutex_get(&mm_pdev->dev);
> -		if (!mdp->mdp_mutex[i]) {
> -			ret = -ENODEV;
> +		if (IS_ERR(mdp->mdp_mutex[i])) {
> +			ret = PTR_ERR(mdp->mdp_mutex[i]);
>   			goto err_return;
>   		}
>   	}
> 

That's true, and I fully agree.
While you're at it, can you also fix the err_return case?

if (mdp)
	for ...
		if (!IS_ERR_OR_NULL(mdp->mdp_mutex[i]))
			mtk_mutex_put(...)


Thanks,
Angelo

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] media: platform: mtk-mdp3: Fix return value check in mdp_probe()
  2022-11-30  9:44   ` AngeloGioacchino Del Regno
@ 2022-12-01  2:09     ` Qiheng Lin
  -1 siblings, 0 replies; 6+ messages in thread
From: Qiheng Lin @ 2022-12-01  2:09 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: mchehab, matthias.bgg, linux-media, linux-arm-kernel,
	linux-mediatek, linux-kernel

在 2022/11/30 17:44, AngeloGioacchino Del Regno 写道:
> Il 30/11/22 09:13, Qiheng Lin ha scritto:
>> In case of error, the function mtk_mutex_get()
>> returns ERR_PTR() and never returns NULL. The NULL test in the
>> return value check should be replaced with IS_ERR().
>>
>> Fixes: 61890ccaefaf ("media: platform: mtk-mdp3: add MediaTek MDP3 
>> driver")
>> Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
>> ---
>>   drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c 
>> b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
>> index c413e59d4286..7a2d992dd842 100644
>> --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
>> +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
>> @@ -207,8 +207,8 @@ static int mdp_probe(struct platform_device *pdev)
>>       }
>>       for (i = 0; i < MDP_PIPE_MAX; i++) {
>>           mdp->mdp_mutex[i] = mtk_mutex_get(&mm_pdev->dev);
>> -        if (!mdp->mdp_mutex[i]) {
>> -            ret = -ENODEV;
>> +        if (IS_ERR(mdp->mdp_mutex[i])) {
>> +            ret = PTR_ERR(mdp->mdp_mutex[i]);
>>               goto err_return;
>>           }
>>       }
>>
> 
> That's true, and I fully agree.
> While you're at it, can you also fix the err_return case?
> 
> if (mdp)
>      for ...
>          if (!IS_ERR_OR_NULL(mdp->mdp_mutex[i]))
>              mtk_mutex_put(...)
> 

Thanks for your suggestion, will send the v2.

> Thanks,
> Angelo


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] media: platform: mtk-mdp3: Fix return value check in mdp_probe()
@ 2022-12-01  2:09     ` Qiheng Lin
  0 siblings, 0 replies; 6+ messages in thread
From: Qiheng Lin @ 2022-12-01  2:09 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: mchehab, matthias.bgg, linux-media, linux-arm-kernel,
	linux-mediatek, linux-kernel

在 2022/11/30 17:44, AngeloGioacchino Del Regno 写道:
> Il 30/11/22 09:13, Qiheng Lin ha scritto:
>> In case of error, the function mtk_mutex_get()
>> returns ERR_PTR() and never returns NULL. The NULL test in the
>> return value check should be replaced with IS_ERR().
>>
>> Fixes: 61890ccaefaf ("media: platform: mtk-mdp3: add MediaTek MDP3 
>> driver")
>> Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
>> ---
>>   drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c 
>> b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
>> index c413e59d4286..7a2d992dd842 100644
>> --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
>> +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
>> @@ -207,8 +207,8 @@ static int mdp_probe(struct platform_device *pdev)
>>       }
>>       for (i = 0; i < MDP_PIPE_MAX; i++) {
>>           mdp->mdp_mutex[i] = mtk_mutex_get(&mm_pdev->dev);
>> -        if (!mdp->mdp_mutex[i]) {
>> -            ret = -ENODEV;
>> +        if (IS_ERR(mdp->mdp_mutex[i])) {
>> +            ret = PTR_ERR(mdp->mdp_mutex[i]);
>>               goto err_return;
>>           }
>>       }
>>
> 
> That's true, and I fully agree.
> While you're at it, can you also fix the err_return case?
> 
> if (mdp)
>      for ...
>          if (!IS_ERR_OR_NULL(mdp->mdp_mutex[i]))
>              mtk_mutex_put(...)
> 

Thanks for your suggestion, will send the v2.

> Thanks,
> Angelo


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-12-01  2:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-30  8:13 [PATCH] media: platform: mtk-mdp3: Fix return value check in mdp_probe() Qiheng Lin
2022-11-30  8:13 ` Qiheng Lin
2022-11-30  9:44 ` AngeloGioacchino Del Regno
2022-11-30  9:44   ` AngeloGioacchino Del Regno
2022-12-01  2:09   ` Qiheng Lin
2022-12-01  2:09     ` Qiheng Lin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.