Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/msm/dpu: Fix pointer dereferenced before checking

The phys_enc->wb_idx is dereferencing before null checking, so move
it after checking.

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Fixes: d7d0e73f7de33 ("drm/msm/dpu: introduce the dpu_encoder_phys_* for
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/487606/
Link: https://lore.kernel.org/r/1653877196-23114-1-git-send-email-baihaowen@meizu.com
Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>

authored by

Haowen Bai and committed by
Abhinav Kumar
8caad14e fb0af2da

+2 -2
+2 -2
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c
··· 574 574 */ 575 575 static void dpu_encoder_phys_wb_destroy(struct dpu_encoder_phys *phys_enc) 576 576 { 577 - DPU_DEBUG("[wb:%d]\n", phys_enc->wb_idx - WB_0); 578 - 579 577 if (!phys_enc) 580 578 return; 579 + 580 + DPU_DEBUG("[wb:%d]\n", phys_enc->wb_idx - WB_0); 581 581 582 582 kfree(phys_enc); 583 583 }