From: sashiko-bot@kernel.org
To: "Maxime Ripard" <mripard@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v7 34/34] drm/bridge: sii902x: Implement hw state readout
Date: Thu, 29 Oct 2026 08:12:34 +0000 [thread overview]
Message-ID: <sashiko-outbox-188951@kernel.org> (raw)
In-Reply-To: <20261029-drm-state-readout-v7-34-25e5163d75c3@kernel.org>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] drm/bridge: sii902x: missing mutex lock in readout callbacks
- [Medium] drm/bridge: sii902x: ignored regmap_test_bits() error in readout_state()
--
commit ce74a42cab42e6bb481c531e7732368f37a0e27c
Author: Maxime Ripard <mripard@kernel.org>
drm/bridge: sii902x: Implement hw state readout
This commit implements hardware state readout callbacks for the sii902x
bridge driver and enables DRM_BRIDGE_OP_CONNECTOR_HW_READOUT.
> diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c
> index e067c0636e7f5..ab5ffcf6882f2 100644
> --- a/drivers/gpu/drm/bridge/sii902x.c
> +++ b/drivers/gpu/drm/bridge/sii902x.c
[ ... ]
> @@ -537,6 +539,89 @@ sii902x_bridge_mode_valid(struct drm_bridge *bridge,
> return MODE_OK;
> }
>
> +static int
> +sii902x_bridge_connector_readout(struct drm_bridge *bridge,
> + struct drm_atomic_sro_state *state,
> + struct drm_connector_state *conn_state)
> +{
> + struct sii902x *sii902x = bridge_to_sii902x(bridge);
> + struct drm_connector *connector = conn_state->connector;
> + struct drm_crtc_state *crtc_state;
> + struct drm_encoder *encoder;
> + struct drm_crtc *crtc;
> + int ret;
> +
> + ret = regmap_test_bits(sii902x->regmap, SII902X_SYS_CTRL_DATA, SII902X_SYS_CTRL_PWR_DWN);
[Severity: High]
Should sii902x_bridge_connector_readout() and sii902x_bridge_readout_state()
hold sii902x->mutex around their regmap_test_bits() calls?
In drivers/gpu/drm/bridge/sii902x.c, sii902x_regmap_config disables regmap's
internal locking:
static const struct regmap_config sii902x_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
.disable_locking = true, /* struct sii902x mutex should be enough */
...
};
All other post-init regmap callers in this driver (such as
sii902x_interrupt(), sii902x_detect(), sii902x_edid_read(),
sii902x_bridge_mode_set(), and the audio callbacks) serialize access via
sii902x->mutex.
Without holding sii902x->mutex here, an unlocked regmap_test_bits() during
initial state readout or post-commit drm_atomic_sro_readout_and_compare()
can race with concurrent HPD interrupt handling, DDC operations, or ALSA
audio callbacks and clobber regmap's shared map->work_buf or interleave I2C
sequences.
> + /* I2C error */
> + if (ret < 0)
> + return ret;
> + /* Device is powered down, nothing to read out */
> + if (ret)
> + return 0;
[ ... ]
> +static int sii902x_bridge_readout_state(struct drm_bridge *bridge,
> + struct drm_atomic_sro_state *state,
> + struct drm_bridge_state *bridge_state,
> + struct drm_crtc_state *crtc_state,
> + struct drm_connector_state *conn_state)
> +{
> + struct sii902x *sii902x = bridge_to_sii902x(bridge);
> + u32 input_format;
> +
> + if (regmap_test_bits(sii902x->regmap, SII902X_SYS_CTRL_DATA, SII902X_SYS_CTRL_PWR_DWN))
> + return 0;
[Severity: Medium]
What happens in sii902x_bridge_readout_state() if regmap_test_bits() fails
with a negative error code?
Because a negative errno is non-zero, the if condition evaluates to true and
sii902x_bridge_readout_state() returns 0 as though the device were powered
down, leaving bridge_state->input_bus_cfg and bridge_state->output_bus_cfg
unpopulated.
Should this check for ret < 0 and propagate the error like
sii902x_bridge_connector_readout() does above?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261029-drm-state-readout-v7-0-25e5163d75c3@kernel.org?part=34
next prev parent reply other threads:[~2026-10-29 8:12 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 7:33 [PATCH v7 00/34] drm: Implement state readout support Maxime Ripard
2026-10-29 7:33 ` [PATCH v7 01/34] drm/bridge-helper: Don't unlock the connection mutex after a backoff Maxime Ripard
2026-10-29 7:51 ` sashiko-bot
2026-10-29 7:33 ` [PATCH v7 02/34] drm/tests: hdmi-state-helper: Handle EDEADLK in the 420-only test Maxime Ripard
2026-10-29 7:33 ` [PATCH v7 03/34] drm/tests: hdmi-state-helper: Handle EDEADLK in the color format test Maxime Ripard
2026-10-29 7:33 ` [PATCH v7 04/34] drm/atomic: Fix private obj error handling Maxime Ripard
2026-10-29 7:57 ` sashiko-bot
2026-10-29 7:33 ` [PATCH v7 05/34] drm/atomic: Add drm_private_obj name Maxime Ripard
2026-10-29 7:56 ` sashiko-bot
2026-10-29 7:33 ` [PATCH v7 06/34] drm/bridge: Switch print_state to use bridge name Maxime Ripard
2026-10-29 7:33 ` [PATCH v7 07/34] drm/bridge: Add drm_private_obj_is_bridge() Maxime Ripard
2026-10-29 7:33 ` [PATCH v7 08/34] drm/fb-dma-helper: Handle framebuffers without a GEM object Maxime Ripard
2026-10-29 7:33 ` [PATCH v7 09/34] drm/atomic: Export drm_atomic_*_print_state Maxime Ripard
2026-10-29 7:34 ` [PATCH v7 10/34] drm/atomic_sro: Create drm_atomic_sro_state container Maxime Ripard
2026-10-29 7:50 ` sashiko-bot
2026-10-29 7:34 ` [PATCH v7 11/34] drm/atomic_sro: Create kernel parameter to force or disable readout Maxime Ripard
2026-10-29 7:46 ` sashiko-bot
2026-10-29 7:34 ` [PATCH v7 12/34] drm/atomic_sro: Add atomic state readout infrastructure Maxime Ripard
2026-10-29 7:34 ` [PATCH v7 13/34] drm/atomic_sro: Add function to install state into drm objects Maxime Ripard
2026-10-29 7:34 ` [PATCH v7 14/34] drm/atomic_sro: Create documentation Maxime Ripard
2026-10-29 7:34 ` [PATCH v7 15/34] drm/bridge: Handle bridges with hardware state readout Maxime Ripard
2026-10-29 7:59 ` sashiko-bot
2026-10-29 7:34 ` [PATCH v7 16/34] drm/mode-config: Read out hardware state in drm_mode_config_create_state Maxime Ripard
2026-10-29 7:34 ` [PATCH v7 17/34] drm/atomic_sro: Provide helpers to implement hardware state readout Maxime Ripard
2026-10-29 8:02 ` sashiko-bot
2026-10-29 7:34 ` [PATCH v7 18/34] drm/mode-config: Introduce hw_reset hook Maxime Ripard
2026-10-29 7:34 ` [PATCH v7 19/34] drm/modeset-helper: Add drm_mode_config_helper_hw_reset() Maxime Ripard
2026-10-29 7:34 ` [PATCH v7 20/34] drm/atomic_helper: Compare actual and readout states once the commit is done Maxime Ripard
2026-10-29 8:05 ` sashiko-bot
2026-10-29 7:34 ` [PATCH v7 21/34] drm/atomic-state-helper: Provide comparison macros Maxime Ripard
2026-10-29 7:34 ` [PATCH v7 22/34] drm/atomic-state-helper: Provide atomic_compare_state helpers Maxime Ripard
2026-10-29 8:07 ` sashiko-bot
2026-10-29 7:34 ` [PATCH v7 23/34] drm/atomic-helper: Document State Read-Out as a state initialization approach Maxime Ripard
2026-10-29 7:34 ` [PATCH v7 24/34] drm/tests: kunit: Add a drm_printer helper Maxime Ripard
2026-10-29 7:56 ` sashiko-bot
2026-10-29 7:34 ` [PATCH v7 25/34] drm/tests: Add tests for the atomic state readout Maxime Ripard
2026-10-29 8:03 ` sashiko-bot
2026-10-29 7:34 ` [PATCH v7 26/34] drm/encoder: Create atomic_sro_get_current_crtc hook Maxime Ripard
2026-10-29 7:34 ` [PATCH v7 27/34] drm/bridge: display-connector: Implement readout support Maxime Ripard
2026-10-29 7:34 ` [PATCH v7 28/34] drm/bridge_connector: Implement hw readout for connector Maxime Ripard
2026-10-29 8:04 ` sashiko-bot
2026-10-29 7:34 ` [PATCH v7 29/34] drm/tidss: crtc: Add atomic_print_state implementation Maxime Ripard
2026-10-29 7:34 ` [PATCH v7 30/34] drm/tidss: dispc: Improve mode checking logs Maxime Ripard
2026-10-29 7:34 ` [PATCH v7 31/34] drm/tidss: Implement hw_reset Maxime Ripard
2026-10-29 8:09 ` sashiko-bot
2026-10-29 7:34 ` [PATCH v7 32/34] drm/tidss: Implement readout support Maxime Ripard
2026-10-29 8:22 ` sashiko-bot
2026-10-29 7:34 ` [PATCH v7 33/34] drm/tidss: encoder: Implement atomic_sro_get_current_crtc Maxime Ripard
2026-10-29 7:34 ` [PATCH v7 34/34] drm/bridge: sii902x: Implement hw state readout Maxime Ripard
2026-10-29 8:12 ` sashiko-bot [this message]
2026-10-29 15:20 ` [PATCH v7 00/34] drm: Implement state readout support Tomi Valkeinen
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=sashiko-outbox-188951@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=mripard@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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