Hello Dominik Kaszewski,

Commit 8fa813b7fd1e ("drm/amd/display: Remove sink usage from DPMS")
from Jun 19, 2026 (linux-next), leads to the following Smatch static
checker warning:

        drivers/gpu/drm/amd/amdgpu/../display/dc/link/link_dpms.c:2423 
link_set_dpms_off()
        error: we previously assumed 'stream->sink' could be null (see line 
2412)

drivers/gpu/drm/amd/amdgpu/../display/dc/link/link_dpms.c
    2386 enum dc_status link_set_dpms_off(struct pipe_ctx *pipe_ctx)
    2387 {
    2388         DC_LOGGER_INIT(pipe_ctx->stream->ctx->logger);
    2389         struct dc_stream_state *stream = pipe_ctx->stream;
    2390         struct dc *dc = stream->ctx->dc;
    2391         struct dc_link *link = stream->link;
    2392         struct vpg *vpg = get_vpg(pipe_ctx);
    2393         enum dp_panel_mode panel_mode_dp = dp_get_panel_mode(link);
    2394 
    2395         ASSERT(is_master_pipe_for_link(link, pipe_ctx));
    2396 
    2397         if (dc_is_virtual_signal(stream->signal))
    2398                 /* No real hardware to program for virtual signals. */
    2399                 return DC_DPMS_SKIPPED_HANDSHAKE;
    2400 
    2401         if (stream->sink) {
                     ^^^^^^^^^^^^

    2402                 if (stream->sink->sink_signal != SIGNAL_TYPE_VIRTUAL &&
    2403                         stream->sink->sink_signal != SIGNAL_TYPE_NONE) 
{
    2404                         DC_LOG_DC("%s pipe_ctx dispname=%s signal=%x 
link=%d sink_count=%d\n", __func__,
    2405                         stream->sink->edid_caps.display_name,
    2406                         stream->signal, link->link_index, 
link->sink_count);
    2407                 }
    2408         }
    2409 
    2410         link_wait_for_unlocked(link);
    2411 
    2412         if (stream->sink && 
!stream->sink->edid_caps.panel_patch.skip_avmute) {
                     ^^^^^^^^^^^^
These places check for NULL

    2413                 if (dc_is_hdmi_signal(stream->signal))
    2414                         set_avmute(pipe_ctx, true);
    2415         }
    2416 
    2417         dc->hwss.disable_audio_stream(pipe_ctx);
    2418 
    2419         update_psp_stream_config(pipe_ctx, true);
    2420         dc->hwss.blank_stream(pipe_ctx);
    2421 
    2422         if 
(pipe_ctx->link_config.dp_tunnel_settings.should_use_dp_bw_allocation)
--> 2423                 deallocate_usb4_bandwidth(stream);
                                                   ^^^^^^
But here stream->sink is dereferenced without checking.

    2424 
    2425         if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST)
    2426                 deallocate_mst_payload(pipe_ctx);
    2427         else if (dc_is_dp_sst_signal(stream->signal) &&

This email is a free service from the Smatch-CI project [smatch.sf.net].

regards,
dan carpenter

Reply via email to