[PATCH] drm/msm/dp: remove deadcode on dpu_encoder_setup
Jackie Liu
liu.yun at linux.dev
Mon Nov 15 10:24:11 UTC 2021
From: Jackie Liu <liuyun01 at kylinos.cn>
Nobody care about drm_enc on dpu_encoder_setup, cleanup.
[...]
*** CID 1493979: Possible Control flow issues (DEADCODE)
/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c: 2186 in dpu_encoder_setup()
2180
2181 return ret;
2182
2183 fail:
2184 DPU_ERROR("failed to create encoder\n");
2185 if (drm_enc)
>>> CID 1493979: Possible Control flow issues (DEADCODE)
>>> Execution cannot reach this statement: "dpu_encoder_destroy(drm_enc);".
2186 dpu_encoder_destroy(drm_enc);
2187
2188 return ret;
2189
2190
2191 }
[...]
Addresses-Coverity: ("Logically dead code")
Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
Signed-off-by: Jackie Liu <liuyun01 at kylinos.cn>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index e7ee4cfb8461..67c1a979ad98 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -2146,15 +2146,16 @@ int dpu_encoder_setup(struct drm_device *dev, struct drm_encoder *enc,
{
struct msm_drm_private *priv = dev->dev_private;
struct dpu_kms *dpu_kms = to_dpu_kms(priv->kms);
- struct drm_encoder *drm_enc = NULL;
struct dpu_encoder_virt *dpu_enc = NULL;
int ret = 0;
dpu_enc = to_dpu_encoder_virt(enc);
ret = dpu_encoder_setup_display(dpu_enc, dpu_kms, disp_info);
- if (ret)
+ if (ret) {
+ DPU_ERROR("failed to create encoder\n");
goto fail;
+ }
atomic_set(&dpu_enc->frame_done_timeout_ms, 0);
timer_setup(&dpu_enc->frame_done_timer,
@@ -2178,16 +2179,8 @@ int dpu_encoder_setup(struct drm_device *dev, struct drm_encoder *enc,
DPU_DEBUG_ENC(dpu_enc, "created\n");
- return ret;
-
fail:
- DPU_ERROR("failed to create encoder\n");
- if (drm_enc)
- dpu_encoder_destroy(drm_enc);
-
return ret;
-
-
}
struct drm_encoder *dpu_encoder_init(struct drm_device *dev,
--
2.25.1
More information about the dri-devel
mailing list