Skip to content

Commit

Permalink
drm/msm/dpu: Fix error return code in dpu_mdss_init()
Browse files Browse the repository at this point in the history
[ Upstream commit e020ac9 ]

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: 070e64d ("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>
Link: https://lore.kernel.org/r/20210510063805.3262-2-thunder.leizhen@huawei.com
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Rob Clark <robdclark@chromium.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Zhen Lei authored and gregkh committed Jul 14, 2021
1 parent 134a561 commit 1b3985a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,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);
Expand Down Expand Up @@ -250,8 +250,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);
Expand All @@ -260,7 +262,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);
Expand Down

0 comments on commit 1b3985a

Please sign in to comment.