From: Claude Code Review Bot <claude-review@example.com>
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 [thread overview]
Message-ID: <review-patch1-20260310-drm-bridge-atomic-vs-remove-clear_and_put-v2-1-51fe222f3cf0@bootlin.com> (raw)
In-Reply-To: <20260310-drm-bridge-atomic-vs-remove-clear_and_put-v2-1-51fe222f3cf0@bootlin.com>
Patch Review
**Code review**:
The implementation at `drivers/gpu/drm/drm_bridge.c:340-346`:
```c
void drm_bridge_clear_and_put(struct drm_bridge **bridge_pp)
{
struct drm_bridge *bridge = *bridge_pp;
*bridge_pp = NULL;
drm_bridge_put(bridge);
}
```
- **Concurrency concern**: As noted above, both the read of `*bridge_pp` and the write of `NULL` use plain accesses. If this is meant to be safe against concurrent readers (as the commit message strongly implies), the write should be `WRITE_ONCE(*bridge_pp, NULL)` and the initial read should be a corresponding `READ_ONCE`. The kernel has established patterns for this — e.g., `rcu_assign_pointer()` or at minimum `WRITE_ONCE()` / `smp_store_release()`. Without these, the compiler is free to reorder the NULL store after the `drm_bridge_put()` call or even optimize it in unexpected ways.
- **Documentation quality**: The kerneldoc is well-written, with clear examples showing the equivalent manual pattern. The cross-reference added to `drm_bridge_put()` is a nice touch.
- **Naming**: `clear_and_put` follows the existing kernel convention (similar to `fput_and_clear`, though that one is actually named `fput` not `put_and_clear`). The kernel has `kfree_and_null` patterns too. The name is fine.
- **Minor**: The function doesn't explicitly document thread-safety guarantees. If it's not intended to be called concurrently with readers, that should be stated. If it is, it needs the memory barriers.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-03-11 3:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 12:13 [PATCH v2 0/2] drm/bridge: add drm_bridge_clear_and_put() Luca Ceresoli
2026-03-10 12:13 ` [PATCH v2 1/2] " Luca Ceresoli
2026-03-11 3:16 ` Claude Code Review Bot [this message]
2026-03-10 12:13 ` [PATCH v2 2/2] drm/bridge: samsung-dsim: use drm_bridge_clear_and_put() to put the next bridge Luca Ceresoli
2026-03-11 3:16 ` Claude review: " Claude Code Review Bot
2026-03-11 3:16 ` Claude review: drm/bridge: add drm_bridge_clear_and_put() 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-20260310-drm-bridge-atomic-vs-remove-clear_and_put-v2-1-51fe222f3cf0@bootlin.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