All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/1] drm/msm/dpu: Fix error return code in dpu_mdss_init()
@ 2021-05-10  6:38 Zhen Lei
  2021-05-10  6:38 ` [PATCH v2 1/1] " Zhen Lei
  0 siblings, 1 reply; 7+ messages in thread
From: Zhen Lei @ 2021-05-10  6:38 UTC (permalink / raw)
  To: Rob Clark, Sean Paul, David Airlie, Daniel Vetter, Stephen Boyd,
	linux-arm-msm, dri-devel, freedreno, linux-kernel
  Cc: Zhen Lei

v1 --> v2:
According to Stephen Boyd'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(-)

-- 
2.26.0.106.g9fadedd



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

* [PATCH v2 1/1] drm/msm/dpu: Fix error return code in dpu_mdss_init()
  2021-05-10  6:38 [PATCH v2 0/1] drm/msm/dpu: Fix error return code in dpu_mdss_init() Zhen Lei
@ 2021-05-10  6:38 ` Zhen Lei
  2021-05-10 16:55     ` Stephen Boyd
  0 siblings, 1 reply; 7+ messages in thread
From: Zhen Lei @ 2021-05-10  6:38 UTC (permalink / raw)
  To: Rob Clark, Sean Paul, David Airlie, Daniel Vetter, Stephen Boyd,
	linux-arm-msm, dri-devel, freedreno, linux-kernel
  Cc: 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.

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")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c
index 06b56fec04e047a..6b0a7bc87eb75b8 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c
@@ -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);
-- 
2.26.0.106.g9fadedd



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

* Re: [PATCH v2 1/1] drm/msm/dpu: Fix error return code in dpu_mdss_init()
  2021-05-10  6:38 ` [PATCH v2 1/1] " Zhen Lei
@ 2021-05-10 16:55     ` Stephen Boyd
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2021-05-10 16:55 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Rob Clark, Sean Paul, Zhen Lei,
	dri-devel, freedreno, linux-arm-msm, linux-kernel

Quoting Zhen Lei (2021-05-09 23:38:05)
> 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")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---

Reviewed-by: Stephen Boyd <swboyd@chromium.org>

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

* Re: [PATCH v2 1/1] drm/msm/dpu: Fix error return code in dpu_mdss_init()
@ 2021-05-10 16:55     ` Stephen Boyd
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2021-05-10 16:55 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Rob Clark, Sean Paul, Zhen Lei,
	dri-devel, freedreno, linux-arm-msm, linux-kernel

Quoting Zhen Lei (2021-05-09 23:38:05)
> 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")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---

Reviewed-by: Stephen Boyd <swboyd@chromium.org>

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

* Re: [PATCH v2 1/1] drm/msm/dpu: Fix error return code in dpu_mdss_init()
  2021-05-10  3:16   ` Zhen Lei
  (?)
@ 2021-05-15 17:45   ` Dmitry Baryshkov
  -1 siblings, 0 replies; 7+ messages in thread
From: Dmitry Baryshkov @ 2021-05-15 17:45 UTC (permalink / raw)
  To: Zhen Lei, Rob Clark, Sean Paul, David Airlie, Daniel Vetter,
	Anton Ivanov, linux-arm-msm, dri-devel, freedreno, linux-kernel

On 10/05/2021 06:16, Zhen Lei wrote:
> 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")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

> ---
>   drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c
> index 06b56fec04e047a..6b0a7bc87eb75b8 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c
> @@ -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);
> 


-- 
With best wishes
Dmitry

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

* [PATCH v2 1/1] drm/msm/dpu: Fix error return code in dpu_mdss_init()
  2021-05-10  3:16 [PATCH v2 0/1] " Zhen Lei
@ 2021-05-10  3:16   ` Zhen Lei
  0 siblings, 0 replies; 7+ messages in thread
From: Zhen Lei @ 2021-05-10  3:16 UTC (permalink / raw)
  To: Rob Clark, Sean Paul, David Airlie, Daniel Vetter, Anton Ivanov,
	linux-arm-msm, dri-devel, freedreno, linux-kernel
  Cc: 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.

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")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c
index 06b56fec04e047a..6b0a7bc87eb75b8 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c
@@ -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);
-- 
2.26.0.106.g9fadedd



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

* [PATCH v2 1/1] drm/msm/dpu: Fix error return code in dpu_mdss_init()
@ 2021-05-10  3:16   ` Zhen Lei
  0 siblings, 0 replies; 7+ messages in thread
From: Zhen Lei @ 2021-05-10  3:16 UTC (permalink / raw)
  To: Rob Clark, Sean Paul, David Airlie, Daniel Vetter, Anton Ivanov,
	linux-arm-msm, dri-devel, freedreno, linux-kernel
  Cc: 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.

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")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c
index 06b56fec04e047a..6b0a7bc87eb75b8 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c
@@ -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);
-- 
2.26.0.106.g9fadedd



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

end of thread, other threads:[~2021-05-15 17:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10  6:38 [PATCH v2 0/1] drm/msm/dpu: Fix error return code in dpu_mdss_init() Zhen Lei
2021-05-10  6:38 ` [PATCH v2 1/1] " Zhen Lei
2021-05-10 16:55   ` Stephen Boyd
2021-05-10 16:55     ` Stephen Boyd
  -- strict thread matches above, loose matches on Subject: below --
2021-05-10  3:16 [PATCH v2 0/1] " Zhen Lei
2021-05-10  3:16 ` [PATCH v2 1/1] " Zhen Lei
2021-05-10  3:16   ` Zhen Lei
2021-05-15 17:45   ` Dmitry Baryshkov

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.