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/connector: check if destroy function exist
Date: Mon, 25 May 2026 20:21:15 +1000	[thread overview]
Message-ID: <review-patch1-20260521103329.140064-1-andreas@kemnade.info> (raw)
In-Reply-To: <20260521103329.140064-1-andreas@kemnade.info>

Patch Review

**Correctness: Good.**

The `drmm_connector_init()` function at line 525 of `drm_connector.c` explicitly documents and enforces that `.destroy` must be NULL:

```c
/* line 520 */ * The @drm_connector_funcs.destroy hook must be NULL.
...
/* line 533 */ if (drm_WARN_ON(dev, funcs && funcs->destroy))
                   return -EINVAL;
```

This means any connector using `drmm_connector_init()` (like `drm_bridge_connector` at `drm_bridge_connector.c:993`) will have `funcs->destroy == NULL`. Cleanup for these connectors is handled via `drmm_add_action_or_reset()` calling `drm_connector_cleanup_action()` (line 540), not through `.destroy`.

The two call sites fixed are:

1. **`drm_connector_free()` (line 194)** — the `kref` put callback:
```c
if (connector->funcs->destroy)
    connector->funcs->destroy(connector);
```

2. **`drm_connector_free_work_fn()` (line 206)** — the deferred-free worker:
```c
if (connector->funcs->destroy)
    connector->funcs->destroy(connector);
```

Both are correct. When `.destroy` is NULL, there is nothing to call — `drmm` handles the cleanup separately through the managed action.

**Minor observations:**

- The commit message subject has a minor grammatical issue: "check if destroy function exist" should be "check if destroy function exists". Trivial, not blocking.
- It might be worth also checking `connector->funcs` itself for NULL, but in practice `funcs` is always set during `drm_connector_init_only()` and should never be NULL at this point. The current check is sufficient.
- No concern about memory leaks: when `.destroy` is NULL (the `drmm` path), cleanup is already registered via `drmm_add_action_or_reset` calling `drm_connector_cleanup()`, and the memory was allocated with `drmm_kzalloc()` which is also automatically freed. Skipping `.destroy` here is the correct behavior — calling it would have been a double-free.

**Verdict: Correct, minimal, appropriate fix. The `Fixes:` tag is accurate.**

---
Generated by Claude Code Patch Reviewer

      parent reply	other threads:[~2026-05-25 10:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21 10:33 [PATCH] drm/connector: check if destroy function exist Andreas Kemnade
2026-05-25 10:21 ` Claude review: " Claude Code Review Bot
2026-05-25 10:21 ` Claude Code Review Bot [this message]

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-20260521103329.140064-1-andreas@kemnade.info \
    --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