Skip to contentSkip to conversation

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

PATCH Superseded Zhen Lei 3 participants 5 messages May 10, 2021 – May 15, 2021

Subsystems (3)
lore
Share & tools
lore

Zhen Lei

author
#0 lore raw

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

v1 --> v2:
According to Anton Ivanov's review comments, detele the unnecessary local variable initialization "ret = 0".

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

 drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Signature · 1 line
2.26.0.106.g9fadedd
author
#1 lore raw

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

The error code returned by platform_get_irq() is stored in 'irq', it's forgotten to be copied to 'ret' before being returned. As a result, the value 0 of 'ret' is returned incorrectly.

After the above fix is completed, initializing the local variable 'ret' to 0 is no longer needed, remove it.

In addition, when dpu_mdss_init() is successfully returned, the value of 'ret' is always 0. Therefore, replace "return ret" with "return 0" to make the code clearer.

Fixes 070e64dc1bbc ("drm/msm/dpu: Convert to a chained irq chip")
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c +5 -3
index 06b56fec04e047a..6b0a7bc87eb75b8 100644
@@ -225,7 +225,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);
@@ -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);
@@ -263,7 +265,7 @@ int dpu_mdss_init(struct drm_device *dev)
 
 	pm_runtime_enable(dev->dev);
 
-	return ret;
+	return 0;
 
 irq_error:
 	_dpu_mdss_irq_domain_fini(dpu_mdss);
Signature · 1 line
2.26.0.106.g9fadedd
Reviewed-by on v2 1/1
#2 lore raw
Quoted 7 lines · Zhen Lei

The error code returned by platform_get_irq() is stored in 'irq', it's forgotten to be copied to 'ret' before being returned. As a result, the value 0 of 'ret' is returned incorrectly.

After the above fix is completed, initializing the local variable 'ret' to 0 is no longer needed, remove it.

Quoted 7 lines

In addition, when dpu_mdss_init() is successfully returned, the value of 'ret' is always 0. Therefore, replace "return ret" with "return 0" to make the code clearer.

Fixes 070e64dc1bbc ("drm/msm/dpu: Convert to a chained irq chip")
Quoted 39 lines
---
  drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c +5 -3
index 06b56fec04e047a..6b0a7bc87eb75b8 100644
@@ -225,7 +225,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);
@@ -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);
@@ -263,7 +265,7 @@ int dpu_mdss_init(struct drm_device *dev)
 
  	pm_runtime_enable(dev->dev);
 
-	return ret;
+	return 0;
 
  irq_error:
  	_dpu_mdss_irq_domain_fini(dpu_mdss);
Signature · 2 lines
With best wishes
Dmitry
#3 lore raw
In reply to Zhen Lei
Quoted 11 lines · Zhen Lei

v1 --> v2:
According to Anton Ivanov's review comments, detele the unnecessary local variable initialization "ret = 0".

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

  drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)

I do not recall reviewing this.

I think you got the wrong Anton Ivanov - I maintain UML so the previous revision hit someone's else inbox.

Signature · 3 lines
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/
#4 lore raw
Quoted 6 lines · Anton Ivanov
Quoted 5 lines · Zhen Lei

v1 --> v2:
According to Anton Ivanov's review comments, detele the unnecessary local variable initialization "ret = 0".

Quoted 7 lines
Quoted 6 lines

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

  drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 8 +++++---

  1 file changed, 5 insertions(+), 3 deletions(-)

I do not recall reviewing this.

Oh, Sorry, the two e-mails next to each other. I lost sight of them.

Quoted 3 lines

I think you got the wrong Anton Ivanov - I maintain UML so the previous revision hit someone's else inbox.