Skip to contentSkip to conversation

drm/amd/display: Remove unnecessary NULL check in commit_planes_for_stream()

PATCH Applied Dan Carpenter 2 participants 2 messages Jul 13, 2022 – Jul 14, 2022

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

PATCH 1/1 drm/amd/display: Remove unnecessary NULL check in commit_planes_for_stream()

Smatch complains that:

drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:3369 commit_planes_for_stream()
warn: variable dereferenced before check 'stream' (see line 3114)

The 'stream' pointer cannot be NULL and the check can be removed.

---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +1 -1
index dc2c59995a19..76f9af2c5e19 100644
@@ -3366,7 +3366,7 @@ static void commit_planes_for_stream(struct dc *dc,
 					top_pipe_to_program->stream_res.tg,
 					CRTC_STATE_VACTIVE);
 
-			if (stream && should_use_dmub_lock(stream->link)) {
+			if (should_use_dmub_lock(stream->link)) {
 				union dmub_hw_lock_flags hw_locks = { 0 };
 				struct dmub_hw_lock_inst_flags inst_flags = { 0 };
 
Signature · 1 line
2.35.1
Applied
#1 lore raw

Applied. Thanks!

Alex

Quoted 29 lines · Dan Carpenter

Smatch complains that:

drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:3369 commit_planes_for_stream()
warn: variable dereferenced before check 'stream' (see line 3114)

The 'stream' pointer cannot be NULL and the check can be removed.

---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +1 -2
index dc2c59995a19..76f9af2c5e19 100644
@@ -3366,7 +3366,7 @@ static void commit_planes_for_stream(struct dc *dc,
                                        top_pipe_to_program->stream_res.tg,
                                        CRTC_STATE_VACTIVE);
 
-                       if (stream && should_use_dmub_lock(stream->link)) {
+                       if (should_use_dmub_lock(stream->link)) {
                                union dmub_hw_lock_flags hw_locks = { 0 };
                                struct dmub_hw_lock_inst_flags inst_flags = { 0 };
 
--

2.35.1