All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] Fix IS_ERR() vs NULL check for drm
@ 2023-07-14  1:48 ` Gaosheng Cui
  0 siblings, 0 replies; 18+ messages in thread
From: Gaosheng Cui @ 2023-07-14  1:48 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

v3:
- Update the second patch:
  1. change IS_ERR to IS_ERR_OR_NULL
  2. add Dmitry's R-b in this revision:
  link: https://patchwork.freedesktop.org/patch/511035/?series=110745&rev=1

  Thanks!

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] 18+ messages in thread

* [PATCH v3 0/3] Fix IS_ERR() vs NULL check for drm
@ 2023-07-14  1:48 ` Gaosheng Cui
  0 siblings, 0 replies; 18+ messages in thread
From: Gaosheng Cui @ 2023-07-14  1:48 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

v3:
- Update the second patch:
  1. change IS_ERR to IS_ERR_OR_NULL
  2. add Dmitry's R-b in this revision:
  link: https://patchwork.freedesktop.org/patch/511035/?series=110745&rev=1

  Thanks!

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] 18+ messages in thread

* [PATCH v3 1/3] drm/panel: Fix IS_ERR() vs NULL check in nt35950_probe()
  2023-07-14  1:48 ` Gaosheng Cui
@ 2023-07-14  1:48   ` Gaosheng Cui
  -1 siblings, 0 replies; 18+ messages in thread
From: Gaosheng Cui @ 2023-07-14  1:48 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] 18+ messages in thread

* [PATCH v3 1/3] drm/panel: Fix IS_ERR() vs NULL check in nt35950_probe()
@ 2023-07-14  1:48   ` Gaosheng Cui
  0 siblings, 0 replies; 18+ messages in thread
From: Gaosheng Cui @ 2023-07-14  1:48 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] 18+ messages in thread

* [PATCH v3 2/3] drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()
  2023-07-14  1:48 ` Gaosheng Cui
@ 2023-07-14  1:48   ` Gaosheng Cui
  -1 siblings, 0 replies; 18+ messages in thread
From: Gaosheng Cui @ 2023-07-14  1:48 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: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Reviewed-by: Akhil P Oommen <quic_akhilpo@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..bbb1bf33f98e 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_OR_NULL(ptr)))
 				return;
 
 			for (i = 0; i < dwords; i++) {
-- 
2.25.1


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

* [PATCH v3 2/3] drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()
@ 2023-07-14  1:48   ` Gaosheng Cui
  0 siblings, 0 replies; 18+ messages in thread
From: Gaosheng Cui @ 2023-07-14  1:48 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: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Reviewed-by: Akhil P Oommen <quic_akhilpo@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..bbb1bf33f98e 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_OR_NULL(ptr)))
 				return;
 
 			for (i = 0; i < dwords; i++) {
-- 
2.25.1


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

* [PATCH v3 3/3] drm/komeda: Fix IS_ERR() vs NULL check in komeda_component_get_avail_scaler()
  2023-07-14  1:48 ` Gaosheng Cui
@ 2023-07-14  1:48   ` Gaosheng Cui
  -1 siblings, 0 replies; 18+ messages in thread
From: Gaosheng Cui @ 2023-07-14  1:48 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>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.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] 18+ messages in thread

* [PATCH v3 3/3] drm/komeda: Fix IS_ERR() vs NULL check in komeda_component_get_avail_scaler()
@ 2023-07-14  1:48   ` Gaosheng Cui
  0 siblings, 0 replies; 18+ messages in thread
From: Gaosheng Cui @ 2023-07-14  1:48 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>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.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] 18+ messages in thread

* Re: [PATCH v3 2/3] drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()
  2023-07-14  1:48   ` Gaosheng Cui
@ 2023-07-14 19:10     ` Abhinav Kumar
  -1 siblings, 0 replies; 18+ messages in thread
From: Abhinav Kumar @ 2023-07-14 19:10 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/13/2023 6:48 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.
> 

use IS_ERR_OR_NULL()

I can even fix this while applying

> Fixes: 6a8bd08d0465 ("drm/msm: add sudo flag to submit ioctl")
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> Reviewed-by: Akhil P Oommen <quic_akhilpo@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..bbb1bf33f98e 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_OR_NULL(ptr)))
>   				return;
>   
>   			for (i = 0; i < dwords; i++) {

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

* Re: [PATCH v3 2/3] drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()
@ 2023-07-14 19:10     ` Abhinav Kumar
  0 siblings, 0 replies; 18+ messages in thread
From: Abhinav Kumar @ 2023-07-14 19:10 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/13/2023 6:48 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.
> 

use IS_ERR_OR_NULL()

I can even fix this while applying

> Fixes: 6a8bd08d0465 ("drm/msm: add sudo flag to submit ioctl")
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> Reviewed-by: Akhil P Oommen <quic_akhilpo@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..bbb1bf33f98e 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_OR_NULL(ptr)))
>   				return;
>   
>   			for (i = 0; i < dwords; i++) {

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

* Re: [Freedreno] [PATCH v3 2/3] drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()
  2023-07-14 19:10     ` Abhinav Kumar
@ 2023-07-14 19:17       ` Abhinav Kumar
  -1 siblings, 0 replies; 18+ messages in thread
From: Abhinav Kumar @ 2023-07-14 19:17 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/14/2023 12:10 PM, Abhinav Kumar wrote:
> 
> 
> On 7/13/2023 6:48 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.
>>
> 
> use IS_ERR_OR_NULL()
> 
> I can even fix this while applying
> 

Actually even subject line needs correction, so better you push another 
rev.

>> Fixes: 6a8bd08d0465 ("drm/msm: add sudo flag to submit ioctl")
>> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
>> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
>> Reviewed-by: Akhil P Oommen <quic_akhilpo@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..bbb1bf33f98e 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_OR_NULL(ptr)))
>>                   return;
>>               for (i = 0; i < dwords; i++) {

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

* Re: [Freedreno] [PATCH v3 2/3] drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb()
@ 2023-07-14 19:17       ` Abhinav Kumar
  0 siblings, 0 replies; 18+ messages in thread
From: Abhinav Kumar @ 2023-07-14 19:17 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/14/2023 12:10 PM, Abhinav Kumar wrote:
> 
> 
> On 7/13/2023 6:48 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.
>>
> 
> use IS_ERR_OR_NULL()
> 
> I can even fix this while applying
> 

Actually even subject line needs correction, so better you push another 
rev.

>> Fixes: 6a8bd08d0465 ("drm/msm: add sudo flag to submit ioctl")
>> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
>> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
>> Reviewed-by: Akhil P Oommen <quic_akhilpo@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..bbb1bf33f98e 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_OR_NULL(ptr)))
>>                   return;
>>               for (i = 0; i < dwords; i++) {

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

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

Hi Gaosheng,
On Fri, Jul 14, 2023 at 09:48:18AM +0800, Gaosheng Cui wrote:
> The mipi_dsi_device_register_full() returns an ERR_PTR() on failure,
> we should use IS_ERR() to check the return value.

Correct - so the code is indeed wrong.

Can you update it so we print the error code as this can be very
helpful.

And then please use dev_probe_err() too.

	Sam

> 
> 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	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 1/3] drm/panel: Fix IS_ERR() vs NULL check in nt35950_probe()
@ 2023-07-14 19:31     ` Sam Ravnborg
  0 siblings, 0 replies; 18+ messages in thread
From: Sam Ravnborg @ 2023-07-14 19:31 UTC (permalink / raw)
  To: Gaosheng Cui
  Cc: neil.armstrong, quic_eberman, quic_gurus, sean, linux-arm-msm,
	a39.skl, liviu.dudau, quic_abhinavk, dri-devel, james.qian.wang,
	angelogioacchino.delregno, dmitry.baryshkov, marijn.suijten,
	freedreno

Hi Gaosheng,
On Fri, Jul 14, 2023 at 09:48:18AM +0800, Gaosheng Cui wrote:
> The mipi_dsi_device_register_full() returns an ERR_PTR() on failure,
> we should use IS_ERR() to check the return value.

Correct - so the code is indeed wrong.

Can you update it so we print the error code as this can be very
helpful.

And then please use dev_probe_err() too.

	Sam

> 
> 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	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 3/3] drm/komeda: Fix IS_ERR() vs NULL check in komeda_component_get_avail_scaler()
  2023-07-14  1:48   ` Gaosheng Cui
@ 2023-07-21 10:24     ` Liviu Dudau
  -1 siblings, 0 replies; 18+ messages in thread
From: Liviu Dudau @ 2023-07-21 10:24 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

Hi Gaosheng,

On Fri, Jul 14, 2023 at 09:48:20AM +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.
> 
> Fixes: 502932a03fce ("drm/komeda: Add the initial scaler support for CORE")
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> Reviewed-by: Liviu Dudau <liviu.dudau@arm.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))

If you're going to update the other patches to use IS_ERR_OR_NULL() please do so
here too. You can keep my R-b for that change.

Best regards,
Liviu

>  		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] 18+ messages in thread

* Re: [PATCH v3 3/3] drm/komeda: Fix IS_ERR() vs NULL check in komeda_component_get_avail_scaler()
@ 2023-07-21 10:24     ` Liviu Dudau
  0 siblings, 0 replies; 18+ messages in thread
From: Liviu Dudau @ 2023-07-21 10:24 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

Hi Gaosheng,

On Fri, Jul 14, 2023 at 09:48:20AM +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.
> 
> Fixes: 502932a03fce ("drm/komeda: Add the initial scaler support for CORE")
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> Reviewed-by: Liviu Dudau <liviu.dudau@arm.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))

If you're going to update the other patches to use IS_ERR_OR_NULL() please do so
here too. You can keep my R-b for that change.

Best regards,
Liviu

>  		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] 18+ messages in thread

* Re: [PATCH v3 3/3] drm/komeda: Fix IS_ERR() vs NULL check in komeda_component_get_avail_scaler()
  2023-07-21 10:24     ` Liviu Dudau
@ 2023-07-24 14:04       ` cuigaosheng
  -1 siblings, 0 replies; 18+ messages in thread
From: cuigaosheng @ 2023-07-24 14:04 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

> If you're going to update the other patches to use IS_ERR_OR_NULL() please do so
> here too. You can keep my R-b for that change.

Thanks for taking time to review the patch.

I have update the patch set and add this change to v5.

On 2023/7/21 18:24, Liviu Dudau wrote:
> Hi Gaosheng,
>
> On Fri, Jul 14, 2023 at 09:48:20AM +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.
>>
>> Fixes: 502932a03fce ("drm/komeda: Add the initial scaler support for CORE")
>> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
>> Reviewed-by: Liviu Dudau <liviu.dudau@arm.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))
> If you're going to update the other patches to use IS_ERR_OR_NULL() please do so
> here too. You can keep my R-b for that change.
>
> Best regards,
> Liviu
>
>>   		return NULL;
>>   
>>   	avail_scalers = (pipe_st->active_comps & KOMEDA_PIPELINE_SCALERS) ^
>> -- 
>> 2.25.1
>>

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

* Re: [PATCH v3 3/3] drm/komeda: Fix IS_ERR() vs NULL check in komeda_component_get_avail_scaler()
@ 2023-07-24 14:04       ` cuigaosheng
  0 siblings, 0 replies; 18+ messages in thread
From: cuigaosheng @ 2023-07-24 14:04 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

> If you're going to update the other patches to use IS_ERR_OR_NULL() please do so
> here too. You can keep my R-b for that change.

Thanks for taking time to review the patch.

I have update the patch set and add this change to v5.

On 2023/7/21 18:24, Liviu Dudau wrote:
> Hi Gaosheng,
>
> On Fri, Jul 14, 2023 at 09:48:20AM +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.
>>
>> Fixes: 502932a03fce ("drm/komeda: Add the initial scaler support for CORE")
>> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
>> Reviewed-by: Liviu Dudau <liviu.dudau@arm.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))
> If you're going to update the other patches to use IS_ERR_OR_NULL() please do so
> here too. You can keep my R-b for that change.
>
> Best regards,
> Liviu
>
>>   		return NULL;
>>   
>>   	avail_scalers = (pipe_st->active_comps & KOMEDA_PIPELINE_SCALERS) ^
>> -- 
>> 2.25.1
>>

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

end of thread, other threads:[~2023-07-24 14:05 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-14  1:48 [PATCH v3 0/3] Fix IS_ERR() vs NULL check for drm Gaosheng Cui
2023-07-14  1:48 ` Gaosheng Cui
2023-07-14  1:48 ` [PATCH v3 1/3] drm/panel: Fix IS_ERR() vs NULL check in nt35950_probe() Gaosheng Cui
2023-07-14  1:48   ` Gaosheng Cui
2023-07-14 19:31   ` Sam Ravnborg
2023-07-14 19:31     ` Sam Ravnborg
2023-07-14  1:48 ` [PATCH v3 2/3] drm/msm: Fix IS_ERR() vs NULL check in a5xx_submit_in_rb() Gaosheng Cui
2023-07-14  1:48   ` Gaosheng Cui
2023-07-14 19:10   ` Abhinav Kumar
2023-07-14 19:10     ` Abhinav Kumar
2023-07-14 19:17     ` [Freedreno] " Abhinav Kumar
2023-07-14 19:17       ` Abhinav Kumar
2023-07-14  1:48 ` [PATCH v3 3/3] drm/komeda: Fix IS_ERR() vs NULL check in komeda_component_get_avail_scaler() Gaosheng Cui
2023-07-14  1:48   ` Gaosheng Cui
2023-07-21 10:24   ` Liviu Dudau
2023-07-21 10:24     ` Liviu Dudau
2023-07-24 14:04     ` cuigaosheng
2023-07-24 14:04       ` cuigaosheng

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.