From: "Timur Kristóf" <timur.kristof@gmail.com>
To: Alex Hung <alex.hung@amd.com>,
Aurabindo Pillai <aurabindo.pillai@amd.com>,
Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Cc: amd-gfx@lists.freedesktop.org,
Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>,
Harry Wentland <harry.wentland@amd.com>,
Mario Limonciello <superm1@kernel.org>,
ChiaHsuan Chung <chiahsuan.chung@amd.com>,
Roman Li <roman.li@amd.com>,
Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH] drm/amd/display: Fix dc_link NULL handling in HPD init
Date: Fri, 06 Feb 2026 23:49:24 +0100 [thread overview]
Message-ID: <2483344.vFx2qVVIhK@timur-max> (raw)
In-Reply-To: <20260206143730.1477825-1-srinivasan.shanmugam@amd.com>
On 2026. február 6., péntek 15:37:30 közép-európai téli idő Srinivasan
Shanmugam wrote:
> amdgpu_dm_hpd_init() may see connectors without a valid dc_link.
>
> The code already checks dc_link for the polling decision, but later
> unconditionally dereferences it when setting up HPD interrupts.
Please remove or adjust the "Fixes" tag here. It should be:
Fixes: 4562236b3bc0 ("drm/amd/dc: Add dc display driver (v2)")
The dc_link was already unconditionally dereferenced since the beginning of
DC, since the very first commit that introduced DC. The commit "Only poll
analog connectors" did not change the way HPD interrupts are set up.
With the Fixes tag adjusted, the patch is:
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
>
> Assign dc_link early and skip connectors where it is NULL.
>
> Fixes the below:
> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_irq.c:940
> amdgpu_dm_hpd_init() error: we previously assumed 'dc_link' could be null
> (see line 931)
>
> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_irq.c
> 923 /*
> 924 * Analog connectors may be hot-plugged unlike other
> connector 925 * types that don't support HPD. Only poll
> analog connectors. 926 */
> 927 use_polling |=
> 928 amdgpu_dm_connector->dc_link &&
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The patch adds
> this NULL check but hopefully it can be removed
>
> 929
> dc_connector_supports_analog(amdgpu_dm_connector->dc_link->link_id.id); 930
> 931 dc_link = amdgpu_dm_connector->dc_link;
>
> dc_link assigned here.
>
> 932
> 933 /*
> 934 * Get a base driver irq reference for hpd ints for
> the lifetime 935 * of dm. Note that only hpd interrupt
> types are registered with 936 * base driver; hpd_rx types
> aren't. IOW, amdgpu_irq_get/put on 937 * hpd_rx isn't
> available. DM currently controls hpd_rx 938 * explicitly
> with dc_interrupt_set()
> 939 */
> --> 940 if (dc_link->irq_source_hpd !=
> DC_IRQ_SOURCE_INVALID) { ^^^^^^^^^^^^^^^^^^^^^^^ If it's NULL then we are
> trouble because we dereference it here.
>
> 941 irq_type = dc_link->irq_source_hpd -
> DC_IRQ_SOURCE_HPD1; 942 /*
> 943 * TODO: There's a mismatch between
> mode_info.num_hpd 944 * and what bios reports as
> the # of connectors with hpd
>
> Fixes: e07945681dfe ("drm/amd/display: Only poll analog connectors")
> Cc: Timur Kristóf <timur.kristof@gmail.com>
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Mario Limonciello <superm1@kernel.org>
> Cc: Alex Hung <alex.hung@amd.com>
> Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
> Cc: ChiaHsuan Chung <chiahsuan.chung@amd.com>
> Cc: Roman Li <roman.li@amd.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
> ---
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c index
> e7b0928bd3db..5948e2a6219e 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c
> @@ -919,16 +919,15 @@ void amdgpu_dm_hpd_init(struct amdgpu_device *adev)
> continue;
>
> amdgpu_dm_connector =
to_amdgpu_dm_connector(connector);
> + dc_link = amdgpu_dm_connector->dc_link;
> + if (!dc_link)
> + continue;
>
> /*
> * Analog connectors may be hot-plugged unlike other
connector
> * types that don't support HPD. Only poll analog
connectors.
> */
> - use_polling |=
> - amdgpu_dm_connector->dc_link &&
> -
dc_connector_supports_analog(amdgpu_dm_connector->dc_link->link_id.id);
> -
> - dc_link = amdgpu_dm_connector->dc_link;
> + use_polling |= dc_connector_supports_analog(dc_link-
>link_id.id);
>
> /*
> * Get a base driver irq reference for hpd ints for the
lifetime
prev parent reply other threads:[~2026-02-06 22:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-06 14:37 [PATCH] drm/amd/display: Fix dc_link NULL handling in HPD init Srinivasan Shanmugam
2026-02-06 22:49 ` Timur Kristóf [this message]
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=2483344.vFx2qVVIhK@timur-max \
--to=timur.kristof@gmail.com \
--cc=alex.hung@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=aurabindo.pillai@amd.com \
--cc=chiahsuan.chung@amd.com \
--cc=dan.carpenter@oracle.com \
--cc=harry.wentland@amd.com \
--cc=roman.li@amd.com \
--cc=srinivasan.shanmugam@amd.com \
--cc=superm1@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox