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/connector: check if destroy function exist Date: Mon, 25 May 2026 20:21:15 +1000 Message-ID: In-Reply-To: <20260521103329.140064-1-andreas@kemnade.info> References: <20260521103329.140064-1-andreas@kemnade.info> <20260521103329.140064-1-andreas@kemnade.info> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **Correctness: Good.** The `drmm_connector_init()` function at line 525 of `drm_connector.c` expli= citly 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_co= nnector` at `drm_bridge_connector.c:993`) will have `funcs->destroy =3D=3D = NULL`. Cleanup for these connectors is handled via `drmm_add_action_or_rese= t()` calling `drm_connector_cleanup_action()` (line 540), not through `.des= troy`. The two call sites fixed are: 1. **`drm_connector_free()` (line 194)** =E2=80=94 the `kref` put callback: ```c if (connector->funcs->destroy) connector->funcs->destroy(connector); ``` 2. **`drm_connector_free_work_fn()` (line 206)** =E2=80=94 the deferred-fre= e worker: ```c if (connector->funcs->destroy) connector->funcs->destroy(connector); ``` Both are correct. When `.destroy` is NULL, there is nothing to call =E2=80= =94 `drmm` handles the cleanup separately through the managed action. **Minor observations:** - The commit message subject has a minor grammatical issue: "check if destr= oy function exist" should be "check if destroy function exists". Trivial, n= ot blocking. - It might be worth also checking `connector->funcs` itself for NULL, but i= n practice `funcs` is always set during `drm_connector_init_only()` and sho= uld 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()` wh= ich is also automatically freed. Skipping `.destroy` here is the correct be= havior =E2=80=94 calling it would have been a double-free. **Verdict: Correct, minimal, appropriate fix. The `Fixes:` tag is accurate.= ** --- Generated by Claude Code Patch Reviewer