Skip to content

Commit 7f3d03c

Browse files
author
Abhinav Kumar
committed
drm/msm/dpu: check for valid hw_pp in dpu_encoder_helper_phys_cleanup
The commit 8b45a26 ("drm/msm/dpu: reserve cdm blocks for writeback in case of YUV output") introduced a smatch warning about another conditional block in dpu_encoder_helper_phys_cleanup() which had assumed hw_pp will always be valid which may not necessarily be true. Lets fix the other conditional block by making sure hw_pp is valid before dereferencing it. Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Fixes: ae4d721 ("drm/msm/dpu: add an API to reset the encoder related hw blocks") Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Patchwork: https://patchwork.freedesktop.org/patch/574878/ Link: https://lore.kernel.org/r/20240117194109.21609-1-quic_abhinavk@quicinc.com Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
1 parent fcccdaf commit 7f3d03c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,7 +2068,7 @@ void dpu_encoder_helper_phys_cleanup(struct dpu_encoder_phys *phys_enc)
20682068
}
20692069

20702070
/* reset the merge 3D HW block */
2071-
if (phys_enc->hw_pp->merge_3d) {
2071+
if (phys_enc->hw_pp && phys_enc->hw_pp->merge_3d) {
20722072
phys_enc->hw_pp->merge_3d->ops.setup_3d_mode(phys_enc->hw_pp->merge_3d,
20732073
BLEND_3D_NONE);
20742074
if (phys_enc->hw_ctl->ops.update_pending_flush_merge_3d)
@@ -2099,7 +2099,7 @@ void dpu_encoder_helper_phys_cleanup(struct dpu_encoder_phys *phys_enc)
20992099
if (phys_enc->hw_wb)
21002100
intf_cfg.wb = phys_enc->hw_wb->idx;
21012101

2102-
if (phys_enc->hw_pp->merge_3d)
2102+
if (phys_enc->hw_pp && phys_enc->hw_pp->merge_3d)
21032103
intf_cfg.merge_3d = phys_enc->hw_pp->merge_3d->idx;
21042104

21052105
if (ctl->ops.reset_intf_cfg)

0 commit comments

Comments
 (0)