Skip to contentSkip to conversation

drm/msm/dpu: Fix smatch warnings about variable dereferenced before check

PATCH Applied [email protected] 2 participants 4 messages Jan 30 – Feb 24

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/msm/dpu: Fix smatch warnings about variable dereferenced before check

From: sunliming <[email protected]>

Fix below smatch warnings:
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp_v13.c:161 dpu_hw_sspp_setup_pe_config_v13()
warn: variable dereferenced before check 'ctx' (see line 159)

---
v2: Fix error code

 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp_v13.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp_v13.c +3 -1
index e65f1fc026fd..312ee6597ab1 100644
@@ -156,11 +156,13 @@ static void dpu_hw_sspp_setup_pe_config_v13(struct dpu_hw_sspp *ctx,
 	u8 color;
 	u32 lr_pe[4], tb_pe[4];
 	const u32 bytemask = 0xff;
-	u32 offset = ctx->cap->sblk->sspp_rec0_blk.base;
+	u32 offset;
 
 	if (!ctx || !pe_ext)
 		return;
 
+	offset = ctx->cap->sblk->sspp_rec0_blk.base;
+
 	c = &ctx->hw;
 	/* program SW pixel extension override for all pipes*/
 	for (color = 0; color < DPU_MAX_PLANES; color++) {
Signature · 1 line
2.25.1
#1 lore raw
Quoted 6 lines · On Fri, Jan 30, 2026 at 01:36:15PM +0800, [email protected] wrote:

From: sunliming <[email protected]>

Fix below smatch warnings:
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp_v13.c:161 dpu_hw_sspp_setup_pe_config_v13()
warn: variable dereferenced before check 'ctx' (see line 159)

Quoted 6 lines

---
v2: Fix error code

Which error code?

Quoted 26 lines
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp_v13.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp_v13.c +3 -1
index e65f1fc026fd..312ee6597ab1 100644
@@ -156,11 +156,13 @@ static void dpu_hw_sspp_setup_pe_config_v13(struct dpu_hw_sspp *ctx,
 	u8 color;
 	u32 lr_pe[4], tb_pe[4];
 	const u32 bytemask = 0xff;
-	u32 offset = ctx->cap->sblk->sspp_rec0_blk.base;
+	u32 offset;
 
 	if (!ctx || !pe_ext)
 		return;
 
+	offset = ctx->cap->sblk->sspp_rec0_blk.base;
+
 	c = &ctx->hw;
 	/* program SW pixel extension override for all pipes*/
 	for (color = 0; color < DPU_MAX_PLANES; color++) {
Signature · 1 line
2.25.1
Signature · 2 lines
With best wishes
Dmitry
Reviewed-by on v2 1/1
#2 lore raw
In reply to [email protected]
Quoted 10 lines · On Fri, Jan 30, 2026 at 01:36:15PM +0800, [email protected] wrote:

From: sunliming <[email protected]>

Fix below smatch warnings:
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp_v13.c:161 dpu_hw_sspp_setup_pe_config_v13()
warn: variable dereferenced before check 'ctx' (see line 159)

Quoted 6 lines

---
v2: Fix error code

 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp_v13.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Signature · 2 lines
With best wishes
Dmitry
#3 lore raw
In reply to [email protected]
Quoted 5 lines · On Fri, 30 Jan 2026 13:36:15 +0800, [email protected] wrote:

Fix below smatch warnings:
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp_v13.c:161 dpu_hw_sspp_setup_pe_config_v13()
warn: variable dereferenced before check 'ctx' (see line 159)

Applied to msm-fixes, thanks!

[1/1] drm/msm/dpu: Fix smatch warnings about variable dereferenced before check

      https://gitlab.freedesktop.org/lumag/msm/-/commit/b1dcc804f466

Best regards,

Signature · 2 lines
With best wishes
Dmitry