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/rockchip: analogix_dp: Fix OF node reference leak via auto cleanup Date: Thu, 04 Jun 2026 14:37:02 +1000 Message-ID: In-Reply-To: <20260601065100.1103873-7-damon.ding@rock-chips.com> References: <20260601065100.1103873-1-damon.ding@rock-chips.com> <20260601065100.1103873-7-damon.ding@rock-chips.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 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