All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Fix IS_ERR() vs NULL check for drm
@ 2023-07-13  2:05 ` Gaosheng Cui
  0 siblings, 0 replies; 20+ messages in thread
From: Gaosheng Cui @ 2023-07-13  2:05 UTC (permalink / raw)
  To: liviu.dudau, airlied, daniel, robdclark, quic_abhinavk,
	dmitry.baryshkov, sean, marijn.suijten, neil.armstrong, sam,
	quic_eberman, a39.skl, quic_gurus, cuigaosheng1,
	angelogioacchino.delregno, james.qian.wang
  Cc: dri-devel, linux-arm-msm, freedreno

v2:
- I'm sorry I missed some emails, these patches were submitted last year,
  now let me resend it with the following changes:
  1. remove the patch: "drm/msm: Fix IS_ERR_OR_NULL() vs NULL check in msm_icc_get()"
  2. remove the patch: "drm/vc4: kms: Fix IS_ERR() vs NULL check for vc4_kms"
  3. add "Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>" to the second patch.

  Thanks!

v1:
- This series contains a few fixup patches, to fix IS_ERR() vs NULL check
  for drm, and avoid a potential null-ptr-defer issue, too. Thanks!

Gaosheng Cui (3):
  drm/panel: Fix IS_ERR() vs NULL check in nt35950_probe()
  drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()
  drm/komeda: Fix IS_ERR() vs NULL check in
    komeda_component_get_avail_scaler()

 drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c                      | 2 +-
 drivers/gpu/drm/panel/panel-novatek-nt35950.c              | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

-- 
2.25.1


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

* [PATCH v2 0/3] Fix IS_ERR() vs NULL check for drm
@ 2023-07-13  2:05 ` Gaosheng Cui
  0 siblings, 0 replies; 20+ messages in thread
From: Gaosheng Cui @ 2023-07-13  2:05 UTC (permalink / raw)
  To: liviu.dudau, airlied, daniel, robdclark, quic_abhinavk,
	dmitry.baryshkov, sean, marijn.suijten, neil.armstrong, sam,
	quic_eberman, a39.skl, quic_gurus, cuigaosheng1,
	angelogioacchino.delregno, james.qian.wang
  Cc: linux-arm-msm, freedreno, dri-devel

v2:
- I'm sorry I missed some emails, these patches were submitted last year,
  now let me resend it with the following changes:
  1. remove the patch: "drm/msm: Fix IS_ERR_OR_NULL() vs NULL check in msm_icc_get()"
  2. remove the patch: "drm/vc4: kms: Fix IS_ERR() vs NULL check for vc4_kms"
  3. add "Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>" to the second patch.

  Thanks!

v1:
- This series contains a few fixup patches, to fix IS_ERR() vs NULL check
  for drm, and avoid a potential null-ptr-defer issue, too. Thanks!

Gaosheng Cui (3):
  drm/panel: Fix IS_ERR() vs NULL check in nt35950_probe()
  drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()
  drm/komeda: Fix IS_ERR() vs NULL check in
    komeda_component_get_avail_scaler()

 drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c                      | 2 +-
 drivers/gpu/drm/panel/panel-novatek-nt35950.c              | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

-- 
2.25.1


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

* [PATCH v2 1/3] drm/panel: Fix IS_ERR() vs NULL check in nt35950_probe()
  2023-07-13  2:05 ` Gaosheng Cui
@ 2023-07-13  2:05   ` Gaosheng Cui
  -1 siblings, 0 replies; 20+ messages in thread
From: Gaosheng Cui @ 2023-07-13  2:05 UTC (permalink / raw)
  To: liviu.dudau, airlied, daniel, robdclark, quic_abhinavk,
	dmitry.baryshkov, sean, marijn.suijten, neil.armstrong, sam,
	quic_eberman, a39.skl, quic_gurus, cuigaosheng1,
	angelogioacchino.delregno, james.qian.wang
  Cc: dri-devel, linux-arm-msm, freedreno

The mipi_dsi_device_register_full() returns an ERR_PTR() on failure,
we should use IS_ERR() to check the return value.

Fixes: 623a3531e9cf ("drm/panel: Add driver for Novatek NT35950 DSI DriverIC panels")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
---
 drivers/gpu/drm/panel/panel-novatek-nt35950.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35950.c b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
index 8b108ac80b55..4903bbf1df55 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt35950.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
@@ -571,7 +571,7 @@ static int nt35950_probe(struct mipi_dsi_device *dsi)
 		}
 
 		nt->dsi[1] = mipi_dsi_device_register_full(dsi_r_host, info);
-		if (!nt->dsi[1]) {
+		if (IS_ERR(nt->dsi[1])) {
 			dev_err(dev, "Cannot get secondary DSI node\n");
 			return -ENODEV;
 		}
-- 
2.25.1


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

* [PATCH v2 1/3] drm/panel: Fix IS_ERR() vs NULL check in nt35950_probe()
@ 2023-07-13  2:05   ` Gaosheng Cui
  0 siblings, 0 replies; 20+ messages in thread
From: Gaosheng Cui @ 2023-07-13  2:05 UTC (permalink / raw)
  To: liviu.dudau, airlied, daniel, robdclark, quic_abhinavk,
	dmitry.baryshkov, sean, marijn.suijten, neil.armstrong, sam,
	quic_eberman, a39.skl, quic_gurus, cuigaosheng1,
	angelogioacchino.delregno, james.qian.wang
  Cc: linux-arm-msm, freedreno, dri-devel

The mipi_dsi_device_register_full() returns an ERR_PTR() on failure,
we should use IS_ERR() to check the return value.

Fixes: 623a3531e9cf ("drm/panel: Add driver for Novatek NT35950 DSI DriverIC panels")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
---
 drivers/gpu/drm/panel/panel-novatek-nt35950.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35950.c b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
index 8b108ac80b55..4903bbf1df55 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt35950.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt35950.c
@@ -571,7 +571,7 @@ static int nt35950_probe(struct mipi_dsi_device *dsi)
 		}
 
 		nt->dsi[1] = mipi_dsi_device_register_full(dsi_r_host, info);
-		if (!nt->dsi[1]) {
+		if (IS_ERR(nt->dsi[1])) {
 			dev_err(dev, "Cannot get secondary DSI node\n");
 			return -ENODEV;
 		}
-- 
2.25.1


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

* [PATCH v2 2/3] drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()
  2023-07-13  2:05 ` Gaosheng Cui
@ 2023-07-13  2:05   ` Gaosheng Cui
  -1 siblings, 0 replies; 20+ messages in thread
From: Gaosheng Cui @ 2023-07-13  2:05 UTC (permalink / raw)
  To: liviu.dudau, airlied, daniel, robdclark, quic_abhinavk,
	dmitry.baryshkov, sean, marijn.suijten, neil.armstrong, sam,
	quic_eberman, a39.skl, quic_gurus, cuigaosheng1,
	angelogioacchino.delregno, james.qian.wang
  Cc: dri-devel, linux-arm-msm, freedreno

The msm_gem_get_vaddr() returns an ERR_PTR() on failure, we should
use IS_ERR() to check the return value.

Fixes: 6a8bd08d0465 ("drm/msm: add sudo flag to submit ioctl")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index a99310b68793..a499e3b350fc 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -89,7 +89,7 @@ static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct msm_gem_submit *submit
 			 * since we've already mapped it once in
 			 * submit_reloc()
 			 */
-			if (WARN_ON(!ptr))
+			if (WARN_ON(IS_ERR(ptr)))
 				return;
 
 			for (i = 0; i < dwords; i++) {
-- 
2.25.1


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

* [PATCH v2 2/3] drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()
@ 2023-07-13  2:05   ` Gaosheng Cui
  0 siblings, 0 replies; 20+ messages in thread
From: Gaosheng Cui @ 2023-07-13  2:05 UTC (permalink / raw)
  To: liviu.dudau, airlied, daniel, robdclark, quic_abhinavk,
	dmitry.baryshkov, sean, marijn.suijten, neil.armstrong, sam,
	quic_eberman, a39.skl, quic_gurus, cuigaosheng1,
	angelogioacchino.delregno, james.qian.wang
  Cc: linux-arm-msm, freedreno, dri-devel

The msm_gem_get_vaddr() returns an ERR_PTR() on failure, we should
use IS_ERR() to check the return value.

Fixes: 6a8bd08d0465 ("drm/msm: add sudo flag to submit ioctl")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index a99310b68793..a499e3b350fc 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -89,7 +89,7 @@ static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct msm_gem_submit *submit
 			 * since we've already mapped it once in
 			 * submit_reloc()
 			 */
-			if (WARN_ON(!ptr))
+			if (WARN_ON(IS_ERR(ptr)))
 				return;
 
 			for (i = 0; i < dwords; i++) {
-- 
2.25.1


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

* [PATCH v2 3/3] drm/komeda: Fix IS_ERR() vs NULL check in komeda_component_get_avail_scaler()
  2023-07-13  2:05 ` Gaosheng Cui
@ 2023-07-13  2:05   ` Gaosheng Cui
  -1 siblings, 0 replies; 20+ messages in thread
From: Gaosheng Cui @ 2023-07-13  2:05 UTC (permalink / raw)
  To: liviu.dudau, airlied, daniel, robdclark, quic_abhinavk,
	dmitry.baryshkov, sean, marijn.suijten, neil.armstrong, sam,
	quic_eberman, a39.skl, quic_gurus, cuigaosheng1,
	angelogioacchino.delregno, james.qian.wang
  Cc: dri-devel, linux-arm-msm, freedreno

The komeda_pipeline_get_state() returns an ERR_PTR() on failure, we should
use IS_ERR() to check the return value.

Fixes: 502932a03fce ("drm/komeda: Add the initial scaler support for CORE")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
---
 drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
index 3276a3e82c62..e9c92439398d 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
@@ -259,7 +259,7 @@ komeda_component_get_avail_scaler(struct komeda_component *c,
 	u32 avail_scalers;
 
 	pipe_st = komeda_pipeline_get_state(c->pipeline, state);
-	if (!pipe_st)
+	if (IS_ERR(pipe_st))
 		return NULL;
 
 	avail_scalers = (pipe_st->active_comps & KOMEDA_PIPELINE_SCALERS) ^
-- 
2.25.1


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

* [PATCH v2 3/3] drm/komeda: Fix IS_ERR() vs NULL check in komeda_component_get_avail_scaler()
@ 2023-07-13  2:05   ` Gaosheng Cui
  0 siblings, 0 replies; 20+ messages in thread
From: Gaosheng Cui @ 2023-07-13  2:05 UTC (permalink / raw)
  To: liviu.dudau, airlied, daniel, robdclark, quic_abhinavk,
	dmitry.baryshkov, sean, marijn.suijten, neil.armstrong, sam,
	quic_eberman, a39.skl, quic_gurus, cuigaosheng1,
	angelogioacchino.delregno, james.qian.wang
  Cc: linux-arm-msm, freedreno, dri-devel

The komeda_pipeline_get_state() returns an ERR_PTR() on failure, we should
use IS_ERR() to check the return value.

Fixes: 502932a03fce ("drm/komeda: Add the initial scaler support for CORE")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
---
 drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
index 3276a3e82c62..e9c92439398d 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
@@ -259,7 +259,7 @@ komeda_component_get_avail_scaler(struct komeda_component *c,
 	u32 avail_scalers;
 
 	pipe_st = komeda_pipeline_get_state(c->pipeline, state);
-	if (!pipe_st)
+	if (IS_ERR(pipe_st))
 		return NULL;
 
 	avail_scalers = (pipe_st->active_comps & KOMEDA_PIPELINE_SCALERS) ^
-- 
2.25.1


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

* Re: [PATCH v2 3/3] drm/komeda: Fix IS_ERR() vs NULL check in komeda_component_get_avail_scaler()
  2023-07-13  2:05   ` Gaosheng Cui
@ 2023-07-13  8:54     ` Liviu Dudau
  -1 siblings, 0 replies; 20+ messages in thread
From: Liviu Dudau @ 2023-07-13  8:54 UTC (permalink / raw)
  To: Gaosheng Cui
  Cc: airlied, daniel, robdclark, quic_abhinavk, dmitry.baryshkov,
	sean, marijn.suijten, neil.armstrong, sam, quic_eberman, a39.skl,
	quic_gurus, angelogioacchino.delregno, james.qian.wang,
	dri-devel, linux-arm-msm, freedreno

Hello,

On Thu, Jul 13, 2023 at 10:05:56AM +0800, Gaosheng Cui wrote:
> The komeda_pipeline_get_state() returns an ERR_PTR() on failure, we should
> use IS_ERR() to check the return value.

While reviewing the change I've realised that komeda_pipeline_get_state_and_set_crtc()
is also mishandling the return value from komeda_pipeline_get_state(). If IS_ERR(st) is
true it should use return ERR_CAST(st), following the same pattern as komeda_pipeline_get_state().

If you don't want to update this patch I can send a separate patch. Otherwise,
the change looks good to me.

Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>

Best regards,
Liviu


> 
> Fixes: 502932a03fce ("drm/komeda: Add the initial scaler support for CORE")
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> ---
>  drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
> index 3276a3e82c62..e9c92439398d 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
> @@ -259,7 +259,7 @@ komeda_component_get_avail_scaler(struct komeda_component *c,
>  	u32 avail_scalers;
>  
>  	pipe_st = komeda_pipeline_get_state(c->pipeline, state);
> -	if (!pipe_st)
> +	if (IS_ERR(pipe_st))
>  		return NULL;
>  
>  	avail_scalers = (pipe_st->active_comps & KOMEDA_PIPELINE_SCALERS) ^
> -- 
> 2.25.1
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

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

* Re: [PATCH v2 3/3] drm/komeda: Fix IS_ERR() vs NULL check in komeda_component_get_avail_scaler()
@ 2023-07-13  8:54     ` Liviu Dudau
  0 siblings, 0 replies; 20+ messages in thread
From: Liviu Dudau @ 2023-07-13  8:54 UTC (permalink / raw)
  To: Gaosheng Cui
  Cc: neil.armstrong, quic_eberman, sam, quic_gurus, linux-arm-msm,
	a39.skl, quic_abhinavk, dri-devel, james.qian.wang,
	angelogioacchino.delregno, dmitry.baryshkov, marijn.suijten,
	freedreno, sean

Hello,

On Thu, Jul 13, 2023 at 10:05:56AM +0800, Gaosheng Cui wrote:
> The komeda_pipeline_get_state() returns an ERR_PTR() on failure, we should
> use IS_ERR() to check the return value.

While reviewing the change I've realised that komeda_pipeline_get_state_and_set_crtc()
is also mishandling the return value from komeda_pipeline_get_state(). If IS_ERR(st) is
true it should use return ERR_CAST(st), following the same pattern as komeda_pipeline_get_state().

If you don't want to update this patch I can send a separate patch. Otherwise,
the change looks good to me.

Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>

Best regards,
Liviu


> 
> Fixes: 502932a03fce ("drm/komeda: Add the initial scaler support for CORE")
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> ---
>  drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
> index 3276a3e82c62..e9c92439398d 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
> @@ -259,7 +259,7 @@ komeda_component_get_avail_scaler(struct komeda_component *c,
>  	u32 avail_scalers;
>  
>  	pipe_st = komeda_pipeline_get_state(c->pipeline, state);
> -	if (!pipe_st)
> +	if (IS_ERR(pipe_st))
>  		return NULL;
>  
>  	avail_scalers = (pipe_st->active_comps & KOMEDA_PIPELINE_SCALERS) ^
> -- 
> 2.25.1
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

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

* Re: [PATCH v2 3/3] drm/komeda: Fix IS_ERR() vs NULL check in komeda_component_get_avail_scaler()
  2023-07-13  8:54     ` Liviu Dudau
@ 2023-07-13  9:51       ` cuigaosheng
  -1 siblings, 0 replies; 20+ messages in thread
From: cuigaosheng @ 2023-07-13  9:51 UTC (permalink / raw)
  To: Liviu Dudau
  Cc: airlied, daniel, robdclark, quic_abhinavk, dmitry.baryshkov,
	sean, marijn.suijten, neil.armstrong, sam, quic_eberman, a39.skl,
	quic_gurus, angelogioacchino.delregno, james.qian.wang,
	dri-devel, linux-arm-msm, freedreno

Thanks for taking time to review this patch.

Maybe we can submit another separate patch to fix ERR_CAST(st), because I'm not
sure which commit should be used as a fixes-tag.

Also, Maybe we should fix ERR_CAST(st) in komeda_pipeline_get_state_and_set_crtc()
and komeda_component_get_state_and_set_user(), please make another separate patch.

Let me know if there's anything I can do, thanks for your work again!

Gaosheng,

On 2023/7/13 16:54, Liviu Dudau wrote:
> Hello,
>
> On Thu, Jul 13, 2023 at 10:05:56AM +0800, Gaosheng Cui wrote:
>> The komeda_pipeline_get_state() returns an ERR_PTR() on failure, we should
>> use IS_ERR() to check the return value.
> While reviewing the change I've realised that komeda_pipeline_get_state_and_set_crtc()
> is also mishandling the return value from komeda_pipeline_get_state(). If IS_ERR(st) is
> true it should use return ERR_CAST(st), following the same pattern as komeda_pipeline_get_state().
>
> If you don't want to update this patch I can send a separate patch. Otherwise,
> the change looks good to me.
>
> Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
>
> Best regards,
> Liviu
>
>
>> Fixes: 502932a03fce ("drm/komeda: Add the initial scaler support for CORE")
>> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
>> ---
>>   drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
>> index 3276a3e82c62..e9c92439398d 100644
>> --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
>> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
>> @@ -259,7 +259,7 @@ komeda_component_get_avail_scaler(struct komeda_component *c,
>>   	u32 avail_scalers;
>>   
>>   	pipe_st = komeda_pipeline_get_state(c->pipeline, state);
>> -	if (!pipe_st)
>> +	if (IS_ERR(pipe_st))
>>   		return NULL;
>>   
>>   	avail_scalers = (pipe_st->active_comps & KOMEDA_PIPELINE_SCALERS) ^
>> -- 
>> 2.25.1
>>

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

* Re: [PATCH v2 3/3] drm/komeda: Fix IS_ERR() vs NULL check in komeda_component_get_avail_scaler()
@ 2023-07-13  9:51       ` cuigaosheng
  0 siblings, 0 replies; 20+ messages in thread
From: cuigaosheng @ 2023-07-13  9:51 UTC (permalink / raw)
  To: Liviu Dudau
  Cc: neil.armstrong, quic_eberman, sam, quic_gurus, linux-arm-msm,
	a39.skl, quic_abhinavk, dri-devel, james.qian.wang,
	angelogioacchino.delregno, dmitry.baryshkov, marijn.suijten,
	freedreno, sean

Thanks for taking time to review this patch.

Maybe we can submit another separate patch to fix ERR_CAST(st), because I'm not
sure which commit should be used as a fixes-tag.

Also, Maybe we should fix ERR_CAST(st) in komeda_pipeline_get_state_and_set_crtc()
and komeda_component_get_state_and_set_user(), please make another separate patch.

Let me know if there's anything I can do, thanks for your work again!

Gaosheng,

On 2023/7/13 16:54, Liviu Dudau wrote:
> Hello,
>
> On Thu, Jul 13, 2023 at 10:05:56AM +0800, Gaosheng Cui wrote:
>> The komeda_pipeline_get_state() returns an ERR_PTR() on failure, we should
>> use IS_ERR() to check the return value.
> While reviewing the change I've realised that komeda_pipeline_get_state_and_set_crtc()
> is also mishandling the return value from komeda_pipeline_get_state(). If IS_ERR(st) is
> true it should use return ERR_CAST(st), following the same pattern as komeda_pipeline_get_state().
>
> If you don't want to update this patch I can send a separate patch. Otherwise,
> the change looks good to me.
>
> Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
>
> Best regards,
> Liviu
>
>
>> Fixes: 502932a03fce ("drm/komeda: Add the initial scaler support for CORE")
>> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
>> ---
>>   drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
>> index 3276a3e82c62..e9c92439398d 100644
>> --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
>> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
>> @@ -259,7 +259,7 @@ komeda_component_get_avail_scaler(struct komeda_component *c,
>>   	u32 avail_scalers;
>>   
>>   	pipe_st = komeda_pipeline_get_state(c->pipeline, state);
>> -	if (!pipe_st)
>> +	if (IS_ERR(pipe_st))
>>   		return NULL;
>>   
>>   	avail_scalers = (pipe_st->active_comps & KOMEDA_PIPELINE_SCALERS) ^
>> -- 
>> 2.25.1
>>

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

* Re: [PATCH v2 3/3] drm/komeda: Fix IS_ERR() vs NULL check in komeda_component_get_avail_scaler()
  2023-07-13  9:51       ` cuigaosheng
@ 2023-07-13 14:18         ` Liviu Dudau
  -1 siblings, 0 replies; 20+ messages in thread
From: Liviu Dudau @ 2023-07-13 14:18 UTC (permalink / raw)
  To: cuigaosheng
  Cc: neil.armstrong, quic_eberman, sam, quic_gurus, linux-arm-msm,
	a39.skl, quic_abhinavk, dri-devel, james.qian.wang,
	angelogioacchino.delregno, dmitry.baryshkov, marijn.suijten,
	freedreno, sean

On Thu, Jul 13, 2023 at 05:51:34PM +0800, cuigaosheng wrote:
> Thanks for taking time to review this patch.
> 
> Maybe we can submit another separate patch to fix ERR_CAST(st), because I'm not
> sure which commit should be used as a fixes-tag.
> 
> Also, Maybe we should fix ERR_CAST(st) in komeda_pipeline_get_state_and_set_crtc()
> and komeda_component_get_state_and_set_user(), please make another separate patch.

Yeah, you're right, there are other places where this needs to be fixed.

I will add this to my list of ToDos.

Best regards,
Liviu

> 
> Let me know if there's anything I can do, thanks for your work again!
> 
> Gaosheng,
> 
> On 2023/7/13 16:54, Liviu Dudau wrote:
> > Hello,
> > 
> > On Thu, Jul 13, 2023 at 10:05:56AM +0800, Gaosheng Cui wrote:
> > > The komeda_pipeline_get_state() returns an ERR_PTR() on failure, we should
> > > use IS_ERR() to check the return value.
> > While reviewing the change I've realised that komeda_pipeline_get_state_and_set_crtc()
> > is also mishandling the return value from komeda_pipeline_get_state(). If IS_ERR(st) is
> > true it should use return ERR_CAST(st), following the same pattern as komeda_pipeline_get_state().
> > 
> > If you don't want to update this patch I can send a separate patch. Otherwise,
> > the change looks good to me.
> > 
> > Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
> > 
> > Best regards,
> > Liviu
> > 
> > 
> > > Fixes: 502932a03fce ("drm/komeda: Add the initial scaler support for CORE")
> > > Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> > > ---
> > >   drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
> > > index 3276a3e82c62..e9c92439398d 100644
> > > --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
> > > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
> > > @@ -259,7 +259,7 @@ komeda_component_get_avail_scaler(struct komeda_component *c,
> > >   	u32 avail_scalers;
> > >   	pipe_st = komeda_pipeline_get_state(c->pipeline, state);
> > > -	if (!pipe_st)
> > > +	if (IS_ERR(pipe_st))
> > >   		return NULL;
> > >   	avail_scalers = (pipe_st->active_comps & KOMEDA_PIPELINE_SCALERS) ^
> > > -- 
> > > 2.25.1
> > > 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

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

* Re: [PATCH v2 3/3] drm/komeda: Fix IS_ERR() vs NULL check in komeda_component_get_avail_scaler()
@ 2023-07-13 14:18         ` Liviu Dudau
  0 siblings, 0 replies; 20+ messages in thread
From: Liviu Dudau @ 2023-07-13 14:18 UTC (permalink / raw)
  To: cuigaosheng
  Cc: airlied, daniel, robdclark, quic_abhinavk, dmitry.baryshkov,
	sean, marijn.suijten, neil.armstrong, sam, quic_eberman, a39.skl,
	quic_gurus, angelogioacchino.delregno, james.qian.wang,
	dri-devel, linux-arm-msm, freedreno

On Thu, Jul 13, 2023 at 05:51:34PM +0800, cuigaosheng wrote:
> Thanks for taking time to review this patch.
> 
> Maybe we can submit another separate patch to fix ERR_CAST(st), because I'm not
> sure which commit should be used as a fixes-tag.
> 
> Also, Maybe we should fix ERR_CAST(st) in komeda_pipeline_get_state_and_set_crtc()
> and komeda_component_get_state_and_set_user(), please make another separate patch.

Yeah, you're right, there are other places where this needs to be fixed.

I will add this to my list of ToDos.

Best regards,
Liviu

> 
> Let me know if there's anything I can do, thanks for your work again!
> 
> Gaosheng,
> 
> On 2023/7/13 16:54, Liviu Dudau wrote:
> > Hello,
> > 
> > On Thu, Jul 13, 2023 at 10:05:56AM +0800, Gaosheng Cui wrote:
> > > The komeda_pipeline_get_state() returns an ERR_PTR() on failure, we should
> > > use IS_ERR() to check the return value.
> > While reviewing the change I've realised that komeda_pipeline_get_state_and_set_crtc()
> > is also mishandling the return value from komeda_pipeline_get_state(). If IS_ERR(st) is
> > true it should use return ERR_CAST(st), following the same pattern as komeda_pipeline_get_state().
> > 
> > If you don't want to update this patch I can send a separate patch. Otherwise,
> > the change looks good to me.
> > 
> > Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
> > 
> > Best regards,
> > Liviu
> > 
> > 
> > > Fixes: 502932a03fce ("drm/komeda: Add the initial scaler support for CORE")
> > > Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> > > ---
> > >   drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
> > > index 3276a3e82c62..e9c92439398d 100644
> > > --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
> > > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
> > > @@ -259,7 +259,7 @@ komeda_component_get_avail_scaler(struct komeda_component *c,
> > >   	u32 avail_scalers;
> > >   	pipe_st = komeda_pipeline_get_state(c->pipeline, state);
> > > -	if (!pipe_st)
> > > +	if (IS_ERR(pipe_st))
> > >   		return NULL;
> > >   	avail_scalers = (pipe_st->active_comps & KOMEDA_PIPELINE_SCALERS) ^
> > > -- 
> > > 2.25.1
> > > 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

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

* Re: [PATCH v2 2/3] drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()
  2023-07-13  2:05   ` Gaosheng Cui
@ 2023-07-13 16:56     ` Abhinav Kumar
  -1 siblings, 0 replies; 20+ messages in thread
From: Abhinav Kumar @ 2023-07-13 16:56 UTC (permalink / raw)
  To: Gaosheng Cui, liviu.dudau, airlied, daniel, robdclark,
	dmitry.baryshkov, sean, marijn.suijten, neil.armstrong, sam,
	quic_eberman, a39.skl, quic_gurus, angelogioacchino.delregno,
	james.qian.wang
  Cc: dri-devel, linux-arm-msm, freedreno



On 7/12/2023 7:05 PM, Gaosheng Cui wrote:
> The msm_gem_get_vaddr() returns an ERR_PTR() on failure, we should
> use IS_ERR() to check the return value.
> 
> Fixes: 6a8bd08d0465 ("drm/msm: add sudo flag to submit ioctl")
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> ---

You dropped Dmitry's R-b in this revision.

https://patchwork.freedesktop.org/patch/511035/?series=110745&rev=1

If you are going to spin a v3, pls add it back. Otherwise I will while 
applying.

>   drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> index a99310b68793..a499e3b350fc 100644
> --- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> @@ -89,7 +89,7 @@ static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct msm_gem_submit *submit
>   			 * since we've already mapped it once in
>   			 * submit_reloc()
>   			 */
> -			if (WARN_ON(!ptr))
> +			if (WARN_ON(IS_ERR(ptr)))
>   				return;
>   
>   			for (i = 0; i < dwords; i++) {

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

* Re: [PATCH v2 2/3] drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()
@ 2023-07-13 16:56     ` Abhinav Kumar
  0 siblings, 0 replies; 20+ messages in thread
From: Abhinav Kumar @ 2023-07-13 16:56 UTC (permalink / raw)
  To: Gaosheng Cui, liviu.dudau, airlied, daniel, robdclark,
	dmitry.baryshkov, sean, marijn.suijten, neil.armstrong, sam,
	quic_eberman, a39.skl, quic_gurus, angelogioacchino.delregno,
	james.qian.wang
  Cc: linux-arm-msm, freedreno, dri-devel



On 7/12/2023 7:05 PM, Gaosheng Cui wrote:
> The msm_gem_get_vaddr() returns an ERR_PTR() on failure, we should
> use IS_ERR() to check the return value.
> 
> Fixes: 6a8bd08d0465 ("drm/msm: add sudo flag to submit ioctl")
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> ---

You dropped Dmitry's R-b in this revision.

https://patchwork.freedesktop.org/patch/511035/?series=110745&rev=1

If you are going to spin a v3, pls add it back. Otherwise I will while 
applying.

>   drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> index a99310b68793..a499e3b350fc 100644
> --- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> @@ -89,7 +89,7 @@ static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct msm_gem_submit *submit
>   			 * since we've already mapped it once in
>   			 * submit_reloc()
>   			 */
> -			if (WARN_ON(!ptr))
> +			if (WARN_ON(IS_ERR(ptr)))
>   				return;
>   
>   			for (i = 0; i < dwords; i++) {

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

* Re: [PATCH v2 2/3] drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()
  2023-07-13  2:05   ` Gaosheng Cui
@ 2023-07-13 19:08     ` Akhil P Oommen
  -1 siblings, 0 replies; 20+ messages in thread
From: Akhil P Oommen @ 2023-07-13 19:08 UTC (permalink / raw)
  To: Gaosheng Cui, g
  Cc: liviu.dudau, airlied, daniel, robdclark, quic_abhinavk,
	dmitry.baryshkov, sean, marijn.suijten, neil.armstrong, sam,
	quic_eberman, a39.skl, quic_gurus, angelogioacchino.delregno,
	james.qian.wang, dri-devel, linux-arm-msm, freedreno

On Thu, Jul 13, 2023 at 10:05:55AM +0800, Gaosheng Cui wrote:
> 
> The msm_gem_get_vaddr() returns an ERR_PTR() on failure, we should
> use IS_ERR() to check the return value.
> 
> Fixes: 6a8bd08d0465 ("drm/msm: add sudo flag to submit ioctl")
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> ---
>  drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> index a99310b68793..a499e3b350fc 100644
> --- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> @@ -89,7 +89,7 @@ static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct msm_gem_submit *submit
>  			 * since we've already mapped it once in
>  			 * submit_reloc()
>  			 */
> -			if (WARN_ON(!ptr))
> +			if (WARN_ON(IS_ERR(ptr)))
nit: can we make this IS_ERR_OR_NULL() check to retain the current
validation? A null is catastrophic here. Yeah, I see that the current
implementation of ...get_vaddr() doesn't return a NULL.

Reviewed-by: Akhil P Oommen <quic_akhilpo@quicinc.com>

-Akhil

>  				return;
>  
>  			for (i = 0; i < dwords; i++) {
> -- 
> 2.25.1
> 

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

* Re: [PATCH v2 2/3] drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()
@ 2023-07-13 19:08     ` Akhil P Oommen
  0 siblings, 0 replies; 20+ messages in thread
From: Akhil P Oommen @ 2023-07-13 19:08 UTC (permalink / raw)
  To: Gaosheng Cui, g
  Cc: neil.armstrong, quic_eberman, sam, quic_gurus, sean,
	linux-arm-msm, a39.skl, liviu.dudau, quic_abhinavk, dri-devel,
	james.qian.wang, angelogioacchino.delregno, dmitry.baryshkov,
	marijn.suijten, freedreno

On Thu, Jul 13, 2023 at 10:05:55AM +0800, Gaosheng Cui wrote:
> 
> The msm_gem_get_vaddr() returns an ERR_PTR() on failure, we should
> use IS_ERR() to check the return value.
> 
> Fixes: 6a8bd08d0465 ("drm/msm: add sudo flag to submit ioctl")
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> ---
>  drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> index a99310b68793..a499e3b350fc 100644
> --- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> @@ -89,7 +89,7 @@ static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct msm_gem_submit *submit
>  			 * since we've already mapped it once in
>  			 * submit_reloc()
>  			 */
> -			if (WARN_ON(!ptr))
> +			if (WARN_ON(IS_ERR(ptr)))
nit: can we make this IS_ERR_OR_NULL() check to retain the current
validation? A null is catastrophic here. Yeah, I see that the current
implementation of ...get_vaddr() doesn't return a NULL.

Reviewed-by: Akhil P Oommen <quic_akhilpo@quicinc.com>

-Akhil

>  				return;
>  
>  			for (i = 0; i < dwords; i++) {
> -- 
> 2.25.1
> 

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

* Re: [PATCH v2 2/3] drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()
  2023-07-13 19:08     ` Akhil P Oommen
@ 2023-07-13 19:40       ` Dmitry Baryshkov
  -1 siblings, 0 replies; 20+ messages in thread
From: Dmitry Baryshkov @ 2023-07-13 19:40 UTC (permalink / raw)
  To: Akhil P Oommen
  Cc: Gaosheng Cui, g, liviu.dudau, airlied, daniel, robdclark,
	quic_abhinavk, sean, marijn.suijten, neil.armstrong, sam,
	quic_eberman, a39.skl, quic_gurus, angelogioacchino.delregno,
	james.qian.wang, dri-devel, linux-arm-msm, freedreno

On Thu, 13 Jul 2023 at 22:08, Akhil P Oommen <quic_akhilpo@quicinc.com> wrote:
>
> On Thu, Jul 13, 2023 at 10:05:55AM +0800, Gaosheng Cui wrote:
> >
> > The msm_gem_get_vaddr() returns an ERR_PTR() on failure, we should
> > use IS_ERR() to check the return value.
> >
> > Fixes: 6a8bd08d0465 ("drm/msm: add sudo flag to submit ioctl")
> > Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> > Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> > ---
> >  drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> > index a99310b68793..a499e3b350fc 100644
> > --- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> > +++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> > @@ -89,7 +89,7 @@ static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct msm_gem_submit *submit
> >                        * since we've already mapped it once in
> >                        * submit_reloc()
> >                        */
> > -                     if (WARN_ON(!ptr))
> > +                     if (WARN_ON(IS_ERR(ptr)))
> nit: can we make this IS_ERR_OR_NULL() check to retain the current
> validation? A null is catastrophic here. Yeah, I see that the current
> implementation of ...get_vaddr() doesn't return a NULL.

I generally dislike IS_ERR_OR_NULL, as it is always (incorrectly)
paired with PTR_ERR. But in the case of void return it would be a
perfect fit.

>
> Reviewed-by: Akhil P Oommen <quic_akhilpo@quicinc.com>
>
> -Akhil
>
> >                               return;
> >
> >                       for (i = 0; i < dwords; i++) {
> > --
> > 2.25.1
> >



-- 
With best wishes
Dmitry

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

* Re: [PATCH v2 2/3] drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()
@ 2023-07-13 19:40       ` Dmitry Baryshkov
  0 siblings, 0 replies; 20+ messages in thread
From: Dmitry Baryshkov @ 2023-07-13 19:40 UTC (permalink / raw)
  To: Akhil P Oommen
  Cc: sean, neil.armstrong, quic_eberman, sam, quic_gurus, g,
	linux-arm-msm, a39.skl, liviu.dudau, quic_abhinavk, dri-devel,
	james.qian.wang, angelogioacchino.delregno, marijn.suijten,
	freedreno, Gaosheng Cui

On Thu, 13 Jul 2023 at 22:08, Akhil P Oommen <quic_akhilpo@quicinc.com> wrote:
>
> On Thu, Jul 13, 2023 at 10:05:55AM +0800, Gaosheng Cui wrote:
> >
> > The msm_gem_get_vaddr() returns an ERR_PTR() on failure, we should
> > use IS_ERR() to check the return value.
> >
> > Fixes: 6a8bd08d0465 ("drm/msm: add sudo flag to submit ioctl")
> > Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> > Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> > ---
> >  drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> > index a99310b68793..a499e3b350fc 100644
> > --- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> > +++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> > @@ -89,7 +89,7 @@ static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct msm_gem_submit *submit
> >                        * since we've already mapped it once in
> >                        * submit_reloc()
> >                        */
> > -                     if (WARN_ON(!ptr))
> > +                     if (WARN_ON(IS_ERR(ptr)))
> nit: can we make this IS_ERR_OR_NULL() check to retain the current
> validation? A null is catastrophic here. Yeah, I see that the current
> implementation of ...get_vaddr() doesn't return a NULL.

I generally dislike IS_ERR_OR_NULL, as it is always (incorrectly)
paired with PTR_ERR. But in the case of void return it would be a
perfect fit.

>
> Reviewed-by: Akhil P Oommen <quic_akhilpo@quicinc.com>
>
> -Akhil
>
> >                               return;
> >
> >                       for (i = 0; i < dwords; i++) {
> > --
> > 2.25.1
> >



-- 
With best wishes
Dmitry

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

end of thread, other threads:[~2023-07-13 19:40 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-13  2:05 [PATCH v2 0/3] Fix IS_ERR() vs NULL check for drm Gaosheng Cui
2023-07-13  2:05 ` Gaosheng Cui
2023-07-13  2:05 ` [PATCH v2 1/3] drm/panel: Fix IS_ERR() vs NULL check in nt35950_probe() Gaosheng Cui
2023-07-13  2:05   ` Gaosheng Cui
2023-07-13  2:05 ` [PATCH v2 2/3] drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb() Gaosheng Cui
2023-07-13  2:05   ` Gaosheng Cui
2023-07-13 16:56   ` Abhinav Kumar
2023-07-13 16:56     ` Abhinav Kumar
2023-07-13 19:08   ` Akhil P Oommen
2023-07-13 19:08     ` Akhil P Oommen
2023-07-13 19:40     ` Dmitry Baryshkov
2023-07-13 19:40       ` Dmitry Baryshkov
2023-07-13  2:05 ` [PATCH v2 3/3] drm/komeda: Fix IS_ERR() vs NULL check in komeda_component_get_avail_scaler() Gaosheng Cui
2023-07-13  2:05   ` Gaosheng Cui
2023-07-13  8:54   ` Liviu Dudau
2023-07-13  8:54     ` Liviu Dudau
2023-07-13  9:51     ` cuigaosheng
2023-07-13  9:51       ` cuigaosheng
2023-07-13 14:18       ` Liviu Dudau
2023-07-13 14:18         ` Liviu Dudau

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.