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/bridge: add drm_bridge_clear_and_put() Date: Wed, 11 Mar 2026 13:16:32 +1000 Message-ID: In-Reply-To: <20260310-drm-bridge-atomic-vs-remove-clear_and_put-v2-0-51fe222f3cf0@bootlin.com> References: <20260310-drm-bridge-atomic-vs-remove-clear_and_put-v2-0-51fe222f3cf0@bootlin.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Overall Series Review Subject: drm/bridge: add drm_bridge_clear_and_put() Author: Luca Ceresoli Patches: 3 Reviewed: 2026-03-11T13:16:32.078777 --- This is a clean, well-motivated 2-patch series that adds a `drm_bridge_clear_and_put()` helper and converts the first user (samsung-dsim) to it. The series is part of ongoing DRM bridge hotplug work. The code is simple, the documentation is thorough, and the conversion in patch 2 is straightforward. **One significant concern**: the commit message and documentation claim this function prevents a "use-after-free window" in concurrent scenarios, but the implementation uses plain C pointer reads and writes with no memory ordering guarantees (no `WRITE_ONCE`, `smp_store_release`, or similar). If another CPU is concurrently reading `*bridge_pp`, the compiler could reorder or cache the store, and the CPU could make it visible after the `kref_put`. For the stated concurrency goal to actually hold, the NULL store should use `WRITE_ONCE()` at minimum to prevent compiler tearing/reordering, and callers reading the pointer should use `READ_ONCE()`. Without that, the "no use-after-free window" claim is not fully guaranteed by the C memory model on SMP systems. That said, looking at the current samsung-dsim usage sites (error path in `host_attach` and the `host_detach` path), these don't appear to have actual concurrent access to `next_bridge`, so the practical risk is low today. But if the goal is to build infrastructure for hotplug where concurrency *will* matter, this should be addressed now. **Verdict**: The series is reasonable as-is for the current use cases, but if it's meant to be a concurrency-safe primitive for hotplug, it needs memory ordering annotations. --- Generated by Claude Code Patch Reviewer