Re: [PATCH 07/13] drm/sun4i: hdmi: Don't leak sync polarity bits into packet control

[email protected] Mon, 03 Aug 2026 16:33:41 +0000
Newsgroups dev.linux.lists.linux-sunxi,org.freedesktop.lists.dri-devel
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(=
s) to consider:

Pre-existing issues:
- [High] Encoder atomic enable callback calls functions that can sleep.
--

--- Patch [7]: [PATCH 07/13] drm/sun4i: hdmi: Don't leak sync polarity bits=
 into packet control ---
commit 65d502c65ade8ff425b6b395888cc0a59bbbb7c3
Author: Jernej Skrabec <[email protected]>

drm/sun4i: hdmi: Don't leak sync polarity bits into packet control

This commit fixes an issue where stale sync polarity bits were ORed into the
packet control register. It replaces the OR assignment with a direct
assignment to prevent selecting incorrect packet types.

> diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun=
4i/sun4i_hdmi_enc.c
> index e99f52ebb26f0..97253d631b2bd 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
> @@ -160,7 +160,7 @@ static void sun4i_hdmi_enable(struct drm_encoder *enc=
oder,
> =20
>  	drm_atomic_helper_connector_hdmi_update_infoframes(connector, state);

[Severity: High]
This isn't a bug introduced by this patch, but does this code sleep in an
atomic context?

The sun4i_hdmi_enable() function is registered as an encoder atomic enable
callback, which executes in an atomic context during non-blocking commits.
However, it calls drm_atomic_helper_connector_hdmi_update_infoframes() here,
which explicitly acquires a mutex. It also calls clk_prepare_enable() just
above this snippet, which can sleep.

Could calling these sleeping functions during atomic commit paths cause
kernel warnings or potential deadlocks?

> -	val |=3D SUN4I_HDMI_PKT_CTRL_TYPE(0, SUN4I_HDMI_PKT_AVI);
> +	val =3D SUN4I_HDMI_PKT_CTRL_TYPE(0, SUN4I_HDMI_PKT_AVI);
>  	val |=3D SUN4I_HDMI_PKT_CTRL_TYPE(1, SUN4I_HDMI_PKT_END);
>  	writel(val, hdmi->base + SUN4I_HDMI_PKT_CTRL_REG(0));
>

--=20
Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/cover.1785772659.gi=
[email protected]?part=3D7