Skip to contentSkip to conversation

drm/msm/dpu: Fix error return code in dpu_mdss_init()

PATCH Superseded Zhen Lei 2 participants 5 messages May 8, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Zhen Lei

author
#0 lore raw

PATCH 1/1 drm/msm/dpu: Fix error return code in dpu_mdss_init()

Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.

Fixes 070e64dc1bbc ("drm/msm/dpu: Convert to a chained irq chip")
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c +3 -1
index 06b56fec04e0..1b6c9fb500a1 100644
@@ -253,8 +253,10 @@ int dpu_mdss_init(struct drm_device *dev)
 		goto irq_domain_error;
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
+	if (irq < 0) {
+		ret = irq;
 		goto irq_error;
+	}
 
 	irq_set_chained_handler_and_data(irq, dpu_mdss_irq,
 					 dpu_mdss);
Signature · 1 line
2.25.1
#1 lore raw

Quoting Zhen Lei (2021-05-07 19:42:54)

Quoted 15 lines

Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.

Fixes 070e64dc1bbc ("drm/msm/dpu: Convert to a chained irq chip")
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c +0 -0
index 06b56fec04e0..1b6c9fb500a1 100644

drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c int dpu_mdss_init(struct drm_device *dev) · line 259

Quoted 8 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c +3 -1
@@ -253,8 +253,10 @@ int dpu_mdss_init(struct drm_device *dev)
                goto irq_domain_error;
 
        irq = platform_get_irq(pdev, 0);
-       if (irq < 0)
+       if (irq < 0) {
+               ret = irq;
                goto irq_error;
+       }

It would be even better if ret wasn't assigned to 0 at the start of this function.

Quoted 3 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c +0 -0
        irq_set_chained_handler_and_data(irq, dpu_mdss_irq,
                                         dpu_mdss);
#2 lore raw
Quoted 18 lines · Stephen Boyd

Quoting Zhen Lei (2021-05-07 19:42:54)

Quoted 17 lines

Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.

Fixes 070e64dc1bbc ("drm/msm/dpu: Convert to a chained irq chip")
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c +0 -0
index 06b56fec04e0..1b6c9fb500a1 100644
@@ -253,8 +253,10 @@ int dpu_mdss_init(struct drm_device *dev)
                goto irq_domain_error;
 
Quoted 9 lines

drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c int dpu_mdss_init(struct drm_device *dev) · line 259

Quoted 6 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c +3 -1
        irq = platform_get_irq(pdev, 0);
-       if (irq < 0)
+       if (irq < 0) {
+               ret = irq;
                goto irq_error;
+       }

It would be even better if ret wasn't assigned to 0 at the start of this function.

The returned error code is not unique.

Quoted 7 lines

drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c int dpu_mdss_init(struct drm_device *dev) · line 262

Quoted 4 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c +0 -0
        irq_set_chained_handler_and_data(irq, dpu_mdss_irq,
                                         dpu_mdss);

.

#3 lore raw

Quoting Leizhen (ThunderTown) (2021-05-08 00:55:04)

Quoted 31 lines · Stephen Boyd
Quoted 18 lines

Quoting Zhen Lei (2021-05-07 19:42:54)

Quoted 17 lines

Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.

Fixes 070e64dc1bbc ("drm/msm/dpu: Convert to a chained irq chip")
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c +0 -0
index 06b56fec04e0..1b6c9fb500a1 100644
@@ -253,8 +253,10 @@ int dpu_mdss_init(struct drm_device *dev)
                goto irq_domain_error;
 
Quoted 9 lines

drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c int dpu_mdss_init(struct drm_device *dev) · line 259

Quoted 6 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c +3 -1
        irq = platform_get_irq(pdev, 0);
-       if (irq < 0)
+       if (irq < 0) {
+               ret = irq;
                goto irq_error;
+       }

It would be even better if ret wasn't assigned to 0 at the start of this function.

Quoted 2 lines

The returned error code is not unique.

What does it mean? I was saying this

----8<----

(quoted diff) +0 -0

b/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c
index cd4078807db1..0fcf190f6322 100644

drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c +5 -3
@@ -263,7 +263,7 @@ int dpu_mdss_init(struct drm_device *dev)
 	struct msm_drm_private *priv = dev->dev_private;
 	struct dpu_mdss *dpu_mdss;
 	struct dss_module_power *mp;
-	int ret = 0;
+	int ret;
 	int irq;
 
 	dpu_mdss = devm_kzalloc(dev->dev, sizeof(*dpu_mdss), GFP_KERNEL);
@@ -297,8 +297,10 @@ int dpu_mdss_init(struct drm_device *dev)
 		goto irq_domain_error;
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
+	if (irq < 0) {
+		ret = irq;
 		goto irq_error;
+	}
 
 	irq_set_chained_handler_and_data(irq, dpu_mdss_irq,
 					 dpu_mdss);
@@ -309,7 +311,7 @@ int dpu_mdss_init(struct drm_device *dev)
 
 	dpu_mdss_icc_request_bw(priv->mdss);
 
-	return ret;
+	return 0;
 
 irq_error:
 	_dpu_mdss_irq_domain_fini(dpu_mdss);
#4 lore raw
Quoted 32 lines · Stephen Boyd

Quoting Leizhen (ThunderTown) (2021-05-08 00:55:04)

Quoted 31 lines · Stephen Boyd
Quoted 27 lines

Quoting Zhen Lei (2021-05-07 19:42:54)

Quoted 15 lines

Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.

Fixes 070e64dc1bbc ("drm/msm/dpu: Convert to a chained irq chip")
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c +0 -0
index 06b56fec04e0..1b6c9fb500a1 100644

drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c int dpu_mdss_init(struct drm_device *dev) · line 259

Quoted 8 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c +3 -1
@@ -253,8 +253,10 @@ int dpu_mdss_init(struct drm_device *dev)
                goto irq_domain_error;
 
        irq = platform_get_irq(pdev, 0);
-       if (irq < 0)
+       if (irq < 0) {
+               ret = irq;
                goto irq_error;
+       }

It would be even better if ret wasn't assigned to 0 at the start of this function.

Quoted 4 lines
Quoted 2 lines

The returned error code is not unique.

What does it mean? I was saying this

Sorry, I misunderstood. I think your opinion is good.

Quoted 40 lines

----8<----

drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c +5 -3
index cd4078807db1..0fcf190f6322 100644
@@ -263,7 +263,7 @@ int dpu_mdss_init(struct drm_device *dev)
 	struct msm_drm_private *priv = dev->dev_private;
 	struct dpu_mdss *dpu_mdss;
 	struct dss_module_power *mp;
-	int ret = 0;
+	int ret;
 	int irq;
 
 	dpu_mdss = devm_kzalloc(dev->dev, sizeof(*dpu_mdss), GFP_KERNEL);
@@ -297,8 +297,10 @@ int dpu_mdss_init(struct drm_device *dev)
 		goto irq_domain_error;
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
+	if (irq < 0) {
+		ret = irq;
 		goto irq_error;
+	}
 
 	irq_set_chained_handler_and_data(irq, dpu_mdss_irq,
 					 dpu_mdss);
@@ -309,7 +311,7 @@ int dpu_mdss_init(struct drm_device *dev)
 
 	dpu_mdss_icc_request_bw(priv->mdss);
 
-	return ret;
+	return 0;
 
 irq_error:
 	_dpu_mdss_irq_domain_fini(dpu_mdss);

.