public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/bridge: it66121: Add bridge-private atomic state
Date: Sat, 16 May 2026 16:11:55 +1000	[thread overview]
Message-ID: <review-patch2-20260510191459.90769-3-javierm@redhat.com> (raw)
In-Reply-To: <20260510191459.90769-3-javierm@redhat.com>

Patch Review

**Status: One issue to address.**

The state subclassing is correctly implemented — `kzalloc_obj(*state)` properly allocates a `struct it66121_bridge_state`, and both `it66121_bridge_atomic_duplicate_state` and `it66121_bridge_atomic_reset` correctly call the `__drm_atomic_helper_bridge_*` helpers on `&state->base`.

**Issue: `atomic_destroy_state` still uses `drm_atomic_helper_bridge_destroy_state`.**

```c
 static const struct drm_bridge_funcs it66121_bridge_funcs = {
 	.atomic_duplicate_state = it66121_bridge_atomic_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
 	.atomic_reset = it66121_bridge_atomic_reset,
```

The documentation on `drm_atomic_helper_bridge_destroy_state()` explicitly says: *"This helper is meant to be used as a bridge atomic_destroy_state hook for bridges that don't subclass the bridge state."*

In practice this works because `base` is the first member of `it66121_bridge_state`, so `kfree(&state->base)` is equivalent to `kfree(state)`. And there is precedent (e.g. `dw-dp.c` does the same). However, it's fragile — if someone later adds a member that requires cleanup (e.g., a sub-allocation), the generic destroy won't handle it. I'd recommend adding a trivial custom destroy for correctness:

```c
static void it66121_bridge_atomic_destroy_state(struct drm_bridge *bridge,
                                                struct drm_bridge_state *state)
{
	struct it66121_bridge_state *it66121_state =
		to_it66121_bridge_state(state);

	kfree(it66121_state);
}
```

This is minor but would be the correct pattern given the subclassing.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-05-16  6:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-10 19:14 [PATCH 0/3] drm/bridge: it66121: Fix display output on DVI monitors Javier Martinez Canillas
2026-05-10 19:14 ` [PATCH 1/3] drm/bridge: it66121: Add bridge_to_it66121_ctx() helper Javier Martinez Canillas
2026-05-16  6:11   ` Claude review: " Claude Code Review Bot
2026-05-10 19:14 ` [PATCH 2/3] drm/bridge: it66121: Add bridge-private atomic state Javier Martinez Canillas
2026-05-16  6:11   ` Claude Code Review Bot [this message]
2026-05-10 19:14 ` [PATCH 3/3] drm/bridge: it66121: Select HDMI or DVI mode based on sink type Javier Martinez Canillas
2026-05-11  7:08   ` Maxime Ripard
2026-05-11 12:48     ` Javier Martinez Canillas
2026-05-11 13:23       ` Maxime Ripard
2026-05-11 13:44         ` Javier Martinez Canillas
2026-05-12  9:24         ` Javier Martinez Canillas
2026-05-16  6:11   ` Claude review: " Claude Code Review Bot
2026-05-16  6:11 ` Claude review: drm/bridge: it66121: Fix display output on DVI monitors 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-patch2-20260510191459.90769-3-javierm@redhat.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