From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/bridge: imx93-mipi-dsi: Fix mode validation
Date: Sat, 16 May 2026 09:49:36 +1000 [thread overview]
Message-ID: <review-patch1-20260515-imx93-mipi-dsi-fix-mode-validation-v3-1-91f7d22b2fe4@nxp.com> (raw)
In-Reply-To: <20260515-imx93-mipi-dsi-fix-mode-validation-v3-1-91f7d22b2fe4@nxp.com>
Patch Review
**Logic change — correct:**
The key change from checking the last bridge to iterating any bridge after the DSI bridge is correct. The commit message clearly explains the scenario: the last bridge is typically a display connector bridge without ops, while an intermediate bridge (e.g., an HDMI bridge chip) is the one that sets `DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID`.
**Refcount handling — correct:**
The helper `imx93_dsi_get_next_bridge_in_chain()` correctly drops the reference on the current bridge before returning the next one:
```c
static inline struct drm_bridge *
imx93_dsi_get_next_bridge_in_chain(struct drm_bridge *bridge)
{
struct drm_bridge *next = drm_bridge_get_next_bridge(bridge);
drm_bridge_put(bridge);
return next;
}
```
Both early-exit paths inside the loop body correctly call `drm_bridge_put(bridge)` before returning/breaking:
```c
drm_bridge_put(bridge);
return MODE_NOCLOCK;
}
drm_bridge_put(bridge);
break;
```
If no bridge matches and the loop exhausts, the last iteration's `imx93_dsi_get_next_bridge_in_chain()` returns NULL after putting the last bridge — also correct.
**Locking — correctly handled:**
The call chain is: `drm_bridge_chain_mode_valid()` → `drm_for_each_bridge_in_chain_from()` (acquires `bridge_chain_mutex`) → `dw_mipi_dsi_bridge_mode_valid()` → `imx93_dsi_mode_valid()` → `imx93_dsi_validate_mode()`. Since `bridge_chain_mutex` is already held, using `drm_for_each_bridge_in_chain_from()` here would deadlock (as discovered in v2). The manual iteration via `drm_bridge_get_next_bridge()` is safe because that function doesn't take the mutex — it just traverses the list, which is protected by the caller's lock.
**Minor observation (non-blocking):**
`dw_mipi_dsi_get_bridge()` returns `&dsi->bridge` — a raw pointer to an embedded struct without incrementing the refcount. The `drm_bridge_get_next_bridge()` API contract states "The caller is responsible of having a reference to @bridge via drm_bridge_get() or equivalent." In practice this is safe because the embedded bridge outlives the call, and the pre-existing code already relied on this same pattern. But a `drm_bridge_get(dmd_bridge)` / `drm_bridge_put(dmd_bridge)` pair would be more strictly correct. This is pre-existing and not introduced by this patch, so not a concern for this fix.
**Reviewed-by: appropriate.** The patch has Frank Li's R-b tag and the fix is straightforward and correct.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-15 23:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-15 6:54 [PATCH v3] drm/bridge: imx93-mipi-dsi: Fix mode validation Liu Ying
2026-05-15 23:49 ` Claude Code Review Bot [this message]
2026-05-15 23:49 ` Claude review: " Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-05-12 9:18 [PATCH v2] " Liu Ying
2026-05-16 3:49 ` Claude review: " Claude Code Review Bot
2026-05-16 3:49 ` Claude Code Review Bot
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=review-patch1-20260515-imx93-mipi-dsi-fix-mode-validation-v3-1-91f7d22b2fe4@nxp.com \
--to=claude-review@example.com \
--cc=dri-devel-reviews@example.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox