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/rockchip: analogix_dp: Fix OF node reference leak via auto cleanup
Date: Thu, 04 Jun 2026 14:37:02 +1000	[thread overview]
Message-ID: <review-patch6-20260601065100.1103873-7-damon.ding@rock-chips.com> (raw)
In-Reply-To: <20260601065100.1103873-7-damon.ding@rock-chips.com>

Patch Review

Fixes a real leak: in the existing code, `of_get_child_by_name(remote_port_parent, "ports")` returns a reference-counted node that is never put. The fix uses `__free(device_node)` for automatic cleanup:

```c
+	struct device_node *remote_port_parent __free(device_node) =
+		of_graph_get_remote_port_parent(endpoint.local_node);
```

```c
+		struct device_node *ports __free(device_node) =
+			of_get_child_by_name(remote_port_parent, "ports");
+		if (ports) {
+			struct device_node *remote_port __free(device_node) =
+				of_graph_get_remote_port(endpoint.local_node);
```

The scoping is correct: `ports` and `remote_port` are declared inside the `if (remote_port_parent)` block, so `__free` will call `of_node_put()` when those variables leave scope. The `remote_port_parent` variable is declared at function scope and will be freed when the function returns.

One minor note: `of_property_read_u32(remote_port, "reg", &port_id)` is called without checking `remote_port` for NULL. If `of_graph_get_remote_port()` returns NULL, this would be a NULL dereference. However, this is a pre-existing issue not introduced by this patch, and in practice the graph endpoint is already validated by `drm_of_encoder_active_endpoint()` above.

No issues with the fix itself.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-06-04  4:37 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-01  6:50 [PATCH v10 00/11] Add eDP support for RK3576 Damon Ding
2026-06-01  6:50 ` [PATCH v10 01/11] dt-bindings: display: rockchip: analogix-dp: Fix hclk as third clock for RK3588 Damon Ding
2026-06-02 17:01   ` Conor Dooley
2026-06-04  4:37   ` Claude review: " Claude Code Review Bot
2026-06-01  6:50 ` [PATCH v10 02/11] dt-bindings: display: rockchip: analogix-dp: Add per-clock descriptions Damon Ding
2026-06-04  4:37   ` Claude review: " Claude Code Review Bot
2026-06-01  6:50 ` [PATCH v10 03/11] arm64: dts: rockchip: Add missing hclk for RK3588 eDP0 Damon Ding
2026-06-04  4:37   ` Claude review: " Claude Code Review Bot
2026-06-01  6:50 ` [PATCH v10 04/11] arm64: dts: rockchip: Add missing hclk for RK3588 eDP1 Damon Ding
2026-06-04  4:37   ` Claude review: " Claude Code Review Bot
2026-06-01  6:50 ` [PATCH v10 05/11] drm/rockchip: analogix_dp: Enable hclk for RK3588 Damon Ding
2026-06-04  4:37   ` Claude review: " Claude Code Review Bot
2026-06-01  6:50 ` [PATCH v10 06/11] drm/rockchip: analogix_dp: Fix OF node reference leak via auto cleanup Damon Ding
2026-06-04  4:37   ` Claude Code Review Bot [this message]
2026-06-01  6:50 ` [PATCH v10 07/11] dt-bindings: display: rockchip: analogix-dp: Add support for RK3576 Damon Ding
2026-06-04  4:37   ` Claude review: " Claude Code Review Bot
2026-06-01  6:50 ` [PATCH v10 08/11] arm64: dts: rockchip: Add eDP node " Damon Ding
2026-06-04  4:37   ` Claude review: " Claude Code Review Bot
2026-06-01  6:50 ` [PATCH v10 09/11] drm/bridge: analogix_dp: Rename and simplify is_rockchip() Damon Ding
2026-06-04  4:37   ` Claude review: " Claude Code Review Bot
2026-06-01  6:50 ` [PATCH v10 10/11] drm/bridge: analogix_dp: Add support for RK3576 Damon Ding
2026-06-04  4:37   ` Claude review: " Claude Code Review Bot
2026-06-01  6:51 ` [PATCH v10 11/11] drm/rockchip: " Damon Ding
2026-06-04  4:37   ` Claude review: " Claude Code Review Bot
2026-06-02 20:05 ` (subset) [PATCH v10 00/11] Add eDP " Heiko Stuebner
2026-06-02 20:41 ` Heiko Stuebner
2026-06-04  4:37 ` Claude review: " 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-patch6-20260601065100.1103873-7-damon.ding@rock-chips.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