All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Dominik Kaszewski <dominik.kaszewski@amd.com>
Cc: amd-gfx@lists.freedesktop.org, "SHANMUGAM,
	SRINIVASAN" <SRINIVASAN.SHANMUGAM@amd.com>
Subject: [bug report] drm/amd/display: Remove sink usage from DPMS
Date: Tue, 15 Sep 2026 19:38:46 +0300	[thread overview]
Message-ID: <aql0litI1KOTQNLk@stanley.mountain> (raw)

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	other threads:[~2026-09-15 21:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aql0litI1KOTQNLk@stanley.mountain \
    --to=error27@gmail.com \
    --cc=SRINIVASAN.SHANMUGAM@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dominik.kaszewski@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.