[bug report] drm/amd/display: Use dmub fw to lock pipe, cursor, dig

Dan Carpenter dan.carpenter at oracle.com
Fri Jun 26 10:06:12 UTC 2020


Hello Wyatt Wood,

This is a semi-automatic email about new static checker warnings.

The patch 4dc079787b23: "drm/amd/display: Use dmub fw to lock pipe,
cursor, dig" from May 27, 2020, leads to the following Smatch
complaint:

    drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c:4091 dc_link_dp_set_test_pattern()
    warn: variable dereferenced before check 'pipe_ctx->stream' (see line 4068)

drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c
  4067					color_space,
  4068					pipe_ctx->stream->use_vsc_sdp_for_colorimetry,
  4069					link->dpcd_caps.dprx_feature.bits.SST_SPLIT_SDP_CAP);
  4070	
  4071			if (pipe_ctx->stream->use_vsc_sdp_for_colorimetry) {
                            ^^^^^^^^^^^^^^^^^^
This is dereferenced in the original code.

  4072				if (test_pattern == DP_TEST_PATTERN_COLOR_SQUARES_CEA)
  4073					pipe_ctx->stream->vsc_infopacket.sb[17] |= (1 << 7); // sb17 bit 7 Dynamic Range: 0 = VESA range, 1 = CTA range
  4074				else
  4075					pipe_ctx->stream->vsc_infopacket.sb[17] &= ~(1 << 7);
  4076				resource_build_info_frame(pipe_ctx);
  4077				link->dc->hwss.update_info_frame(pipe_ctx);
  4078			}
  4079	
  4080			/* CRTC Patterns */
  4081			set_crtc_test_pattern(link, pipe_ctx, test_pattern, test_pattern_color_space);
  4082			pipe_ctx->stream_res.tg->funcs->unlock(pipe_ctx->stream_res.tg);
  4083			pipe_ctx->stream_res.tg->funcs->wait_for_state(pipe_ctx->stream_res.tg,
  4084					CRTC_STATE_VACTIVE);
  4085			pipe_ctx->stream_res.tg->funcs->wait_for_state(pipe_ctx->stream_res.tg,
  4086					CRTC_STATE_VBLANK);
  4087			pipe_ctx->stream_res.tg->funcs->wait_for_state(pipe_ctx->stream_res.tg,
  4088					CRTC_STATE_VACTIVE);
  4089	
  4090			if (pipe_ctx->stream_res.tg->funcs->lock_doublebuffer_disable) {
  4091				if (pipe_ctx->stream && should_use_dmub_lock(pipe_ctx->stream->link)) {
                                    ^^^^^^^^^^^^^^^^
The patch adds a new dereference, is it really required?

  4092					union dmub_hw_lock_flags hw_locks = { 0 };
  4093					struct dmub_hw_lock_inst_flags inst_flags = { 0 };

regards,
dan carpenter


More information about the amd-gfx mailing list