]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/msm/dpu: Fix pointer dereferenced before checking
authorHaowen Bai <baihaowen@meizu.com>
Mon, 30 May 2022 02:19:55 +0000 (10:19 +0800)
committerAbhinav Kumar <quic_abhinavk@quicinc.com>
Wed, 1 Jun 2022 23:16:05 +0000 (16:16 -0700)
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>
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c

index 4829d1ce0cf8f1cc9f22e03a879c2c6239d6aaa3..59da348ff33965c59703423f6a030f5331012385 100644 (file)
@@ -574,11 +574,11 @@ static void dpu_encoder_phys_wb_disable(struct dpu_encoder_phys *phys_enc)
  */
 static void dpu_encoder_phys_wb_destroy(struct dpu_encoder_phys *phys_enc)
 {
-       DPU_DEBUG("[wb:%d]\n", phys_enc->wb_idx - WB_0);
-
        if (!phys_enc)
                return;
 
+       DPU_DEBUG("[wb:%d]\n", phys_enc->wb_idx - WB_0);
+
        kfree(phys_enc);
 }