From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: drm/mode-config: Create drm_mode_config_create_state() Date: Sun, 22 Mar 2026 03:32:28 +1000 Message-ID: In-Reply-To: <20260320-drm-mode-config-init-v2-14-c63f1134e76c@kernel.org> References: <20260320-drm-mode-config-init-v2-0-c63f1134e76c@kernel.org> <20260320-drm-mode-config-init-v2-14-c63f1134e76c@kernel.org> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review **This is the key patch of the series.** Creates `drm_mode_config_create_state()` which iterates all DRM objects and creates initial state via the `atomic_create_state` callbacks, skipping objects that already have state. **Critical issue - missing error cleanup**: When `drm_mode_config_create_state()` fails partway through (e.g., an allocation failure for a connector after planes and CRTCs already got their states allocated), the already-allocated states are not cleaned up: ```c drm_for_each_connector_iter(connector, &conn_iter) { ... ret = drm_mode_config_connector_create_state(connector); if (ret) return ret; // leaks previously allocated states } drm_connector_list_iter_end(&conn_iter); ``` Additionally, returning early from the `drm_for_each_connector_iter` loop without calling `drm_connector_list_iter_end()` will leak the iterator's reference. This needs to be fixed -- either `goto` to cleanup code that calls `drm_connector_list_iter_end()`, or restructure the error path. The doc update to `drm_atomic.c` (lifetime description) is a nice clarification. --- Generated by Claude Code Patch Reviewer