From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/mode-config: Create drm_mode_config_create_initial_state()
Date: Sat, 16 May 2026 13:22:55 +1000 [thread overview]
Message-ID: <review-patch16-20260512-drm-mode-config-init-v4-16-591dfdcc1bf9@kernel.org> (raw)
In-Reply-To: <20260512-drm-mode-config-init-v4-16-591dfdcc1bf9@kernel.org>
Patch Review
**Bug: connector list iterator leaked on error.**
In `drm_mode_config_create_initial_state()`:
```c
drm_connector_list_iter_begin(dev, &conn_iter);
drm_for_each_connector_iter(connector, &conn_iter) {
if (connector->state)
continue;
ret = drm_mode_config_connector_create_state(connector);
if (ret)
return ret; // <-- BUG: misses drm_connector_list_iter_end()
}
drm_connector_list_iter_end(&conn_iter);
```
If `drm_mode_config_connector_create_state()` returns an error, the function returns without calling `drm_connector_list_iter_end(&conn_iter)`. The iterator holds a reference that won't be released. This needs to be fixed, e.g.:
```c
if (ret) {
drm_connector_list_iter_end(&conn_iter);
return ret;
}
```
Additionally, there's **no cleanup of already-allocated states on error**. If, say, plane states are created successfully but a CRTC state allocation fails, the already-created plane states remain allocated and dangling. Whether this matters depends on whether the caller tears down the device on failure — the skeleton in patch 17 shows `return ret` which would trigger `drmm_mode_config_init` cleanup via devres, which should handle it. But it's worth considering explicitly.
Also, the function skips colorop `atomic_create_state` — it calls `drm_atomic_helper_colorop_create_state()` directly, which means drivers cannot override colorop state creation. This is consistent since colorops don't have an `atomic_create_state` callback in `drm_colorop_funcs` (the callback added in patch 7 is a free function, not a vtable entry). Just noting the asymmetry.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-16 3:22 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 13:05 [PATCH v4 00/20] drm/atomic: Rework initial state allocation Maxime Ripard
2026-05-12 13:05 ` [PATCH v4 01/20] drm/atomic: Document atomic commit lifetime Maxime Ripard
2026-05-16 3:22 ` Claude review: " Claude Code Review Bot
2026-05-12 13:06 ` [PATCH v4 02/20] drm/colorop: Fix typos in the doc Maxime Ripard
2026-05-16 3:22 ` Claude review: " Claude Code Review Bot
2026-05-12 13:06 ` [PATCH v4 03/20] drm/atomic: Drop drm_private_obj.state assignment from create_state Maxime Ripard
2026-05-16 3:22 ` Claude review: " Claude Code Review Bot
2026-05-12 13:06 ` [PATCH v4 04/20] drm/atomic: Expand atomic_create_state expectations for drm_private_obj Maxime Ripard
2026-05-16 3:22 ` Claude review: " Claude Code Review Bot
2026-05-12 13:06 ` [PATCH v4 05/20] drm/mode-config: Document drm_private_obj exclusion from drm_mode_config_reset() Maxime Ripard
2026-05-16 3:22 ` Claude review: " Claude Code Review Bot
2026-05-12 13:06 ` [PATCH v4 06/20] drm/colorop: Rename __drm_colorop_state_reset() Maxime Ripard
2026-05-16 3:22 ` Claude review: " Claude Code Review Bot
2026-05-12 13:06 ` [PATCH v4 07/20] drm/colorop: Create drm_atomic_helper_colorop_create_state() Maxime Ripard
2026-05-16 3:22 ` Claude review: " Claude Code Review Bot
2026-05-12 13:06 ` [PATCH v4 08/20] drm/atomic-state-helper: Fix __drm_atomic_helper_plane_reset() doc typo Maxime Ripard
2026-05-16 3:22 ` Claude review: " Claude Code Review Bot
2026-05-12 13:06 ` [PATCH v4 09/20] drm/atomic-state-helper: Rename __drm_atomic_helper_plane_state_reset() Maxime Ripard
2026-05-16 3:22 ` Claude review: " Claude Code Review Bot
2026-05-12 13:06 ` [PATCH v4 10/20] drm/plane: Add new atomic_create_state callback Maxime Ripard
2026-05-16 3:22 ` Claude review: " Claude Code Review Bot
2026-05-12 13:06 ` [PATCH v4 11/20] drm/atomic-state-helper: Rename __drm_atomic_helper_crtc_state_reset() Maxime Ripard
2026-05-16 3:22 ` Claude review: " Claude Code Review Bot
2026-05-12 13:06 ` [PATCH v4 12/20] drm/crtc: Add new atomic_create_state callback Maxime Ripard
2026-05-16 3:22 ` Claude review: " Claude Code Review Bot
2026-05-12 13:06 ` [PATCH v4 13/20] drm/atomic-state-helper: Rename __drm_atomic_helper_connector_state_reset() Maxime Ripard
2026-05-16 3:22 ` Claude review: " Claude Code Review Bot
2026-05-12 13:06 ` [PATCH v4 14/20] drm/hdmi: Rename __drm_atomic_helper_connector_hdmi_reset() Maxime Ripard
2026-05-16 3:22 ` Claude review: " Claude Code Review Bot
2026-05-12 13:06 ` [PATCH v4 15/20] drm/connector: Add new atomic_create_state callback Maxime Ripard
2026-05-16 3:22 ` Claude review: " Claude Code Review Bot
2026-05-12 13:06 ` [PATCH v4 16/20] drm/mode-config: Create drm_mode_config_create_initial_state() Maxime Ripard
2026-05-16 3:22 ` Claude Code Review Bot [this message]
2026-05-12 13:06 ` [PATCH v4 17/20] drm/drv: Switch skeleton to drm_mode_config_create_initial_state() Maxime Ripard
2026-05-16 3:22 ` Claude review: " Claude Code Review Bot
2026-05-12 13:06 ` [PATCH v4 18/20] drm/tidss: Switch " Maxime Ripard
2026-05-16 3:22 ` Claude review: " Claude Code Review Bot
2026-05-12 13:06 ` [PATCH v4 19/20] drm/tidss: Convert to atomic_create_state Maxime Ripard
2026-05-16 3:22 ` Claude review: " Claude Code Review Bot
2026-05-12 13:06 ` [PATCH v4 20/20] drm/bridge_connector: " Maxime Ripard
2026-05-16 3:22 ` Claude review: " Claude Code Review Bot
2026-05-16 3:22 ` Claude review: drm/atomic: Rework initial state allocation 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-patch16-20260512-drm-mode-config-init-v4-16-591dfdcc1bf9@kernel.org \
--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