Skip to contentSkip to conversation

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

PATCH RESEND Superseded [email protected] 4 participants 8 messages Jan 29 – Feb 2

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 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)

---
 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 11 lines · On Thu, Jan 29, 2026 at 10:49:19AM +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)

---

Could you capitalize your name? It's supposed to be a bit formal like signing a legal document.

This isn't a RESEND, it's a v2. A RESEND means we accidentally ignored your email so now you have to send the exact same email again.

https://staticthinking.wordpress.com/2022/07/27/how-to-send-a-v2-patch/

regards,
dan carpenter

author
#2 lore raw
Quoted 7 lines · Dan Carpenter
Quoted 6 lines · On Thu, Jan 29, 2026 at 10:49:19AM +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 5 lines
Quoted 5 lines

---

Previously, a maintainer suggested that the name should match the email address,

but community patches have consistently used the name "sunliming" since then.

Quoted 7 lines
Quoted 7 lines

Could you capitalize your name? It's supposed to be a bit formal like signing a legal document.

This isn't a RESEND, it's a v2. A RESEND means we accidentally ignored your email so now you have to send the exact same email again.

https://staticthinking.wordpress.com/2022/07/27/how-to-send-a-v2-patch/

Get it. thanks.

Quoted 3 lines
Quoted 3 lines

regards,
dan carpenter

#3 lore raw
Quoted 9 lines · sunliming
Quoted 7 lines · Dan Carpenter
Quoted 6 lines · On Thu, Jan 29, 2026 at 10:49:19AM +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 9 lines
Quoted 5 lines
Quoted 5 lines

---

Previously, a maintainer suggested that the name should match the email address,

Yes. But normally people change their email address instead of their name.

Quoted 3 lines

but community patches have consistently used the name "sunliming" since then.

Consistency is less important than being correct... It's just a weird thing to say. Are there other non-community patches with a different name? It's fine if that's your legal name and we have made exceptions for people who aren't able to share their real name because of stalking or whatever...

regards,
dan carpenter

#5 lore raw
In reply to sunliming
Quoted 15 lines · sunliming
Quoted 7 lines · Dan Carpenter
Quoted 6 lines · On Thu, Jan 29, 2026 at 10:49:19AM +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 5 lines
Quoted 5 lines

---

Quoted 5 lines

Previously, a maintainer suggested that the name should match the email address,

but community patches have consistently used the name "sunliming" since then.

There are several possible options here, but I see that this one have been already used to contribute patches, which are accepted. I'm fine with accepting this SoB.

Quoted 12 lines
Quoted 8 lines
Quoted 8 lines

Could you capitalize your name? It's supposed to be a bit formal like signing a legal document.

This isn't a RESEND, it's a v2. A RESEND means we accidentally ignored your email so now you have to send the exact same email again.

https://staticthinking.wordpress.com/2022/07/27/how-to-send-a-v2-patch/

Get it. thanks.

Quoted 3 lines
Quoted 3 lines

regards,
dan carpenter

Signature · 2 lines
With best wishes
Dmitry
Reviewed-by on v1 1/1
#6 lore raw
In reply to [email protected]
Quoted 7 lines · On Thu, Jan 29, 2026 at 10:49:19AM +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)

Closes? (you can just reply to this email with the Closes: line and the URL for the LKP report).

Quoted 7 lines
---
 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
#7 lore raw
In reply to [email protected]
Quoted 21 lines · On Wed, Jan 28, 2026 at 6:50 PM <[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)

---
 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 +0 -0
index e65f1fc026fd..312ee6597ab1 100644
@@ -156,11 +156,13 @@ static void dpu_hw_sspp_setup_pe_config_v13(struct dpu_hw_sspp *ctx,
        u8 color;

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp_v13.c static void dpu_hw_sspp_setup_pe_config_v13(struct dpu_hw_sspp *ctx, · line 165

Quoted 10 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp_v13.c +3 -1
        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;
+

btw, in this case (and probably most/all such cases in dpu code that I've looked at) we should probably just remove the impossible null checks. (Although the extra indirections in the dpu code make it harder to see that they are impossible..)

BR,
-R

Quoted 6 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp_v13.c +0 -1
        c = &ctx->hw;
        /* program SW pixel extension override for all pipes*/
        for (color = 0; color < DPU_MAX_PLANES; color++) {
--

2.25.1

author
#4 lore raw
In reply to Dan Carpenter
Quoted 20 lines · Dan Carpenter
Quoted 8 lines · sunliming
Quoted 7 lines · Dan Carpenter
Quoted 6 lines · On Thu, Jan 29, 2026 at 10:49:19AM +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 8 lines
Quoted 5 lines
Quoted 5 lines

---

Previously, a maintainer suggested that the name should match the email address,

Yes. But normally people change their email address instead of their name.

Quoted 8 lines
Quoted 3 lines

but community patches have consistently used the name "sunliming" since then.

Consistency is less important than being correct... It's just a weird thing to say. Are there other non-community patches with a different name? It's fine if that's your legal name and we have made exceptions for people who aren't able to share their real name because of stalking or whatever...

I have no non-community patches using any other name, and the accounts in

other systems at my employer also use this name. Thanks.

Quoted 3 lines

regards,
dan carpenter