From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/bridge: imx8qxp-pxl2dpi: avoid ERR_PTR with device_node cleanup
Date: Thu, 07 May 2026 13:48:12 +1000 [thread overview]
Message-ID: <review-patch1-20260506092324.635014-1-lgs201920130244@gmail.com> (raw)
In-Reply-To: <20260506092324.635014-1-lgs201920130244@gmail.com>
Patch Review
**Bug analysis:** Correct. The `DEFINE_FREE` for `device_node` at `include/linux/of.h:138`:
```c
DEFINE_FREE(device_node, struct device_node *, if (_T) of_node_put(_T))
```
only guards against NULL, not ERR_PTR. The function `imx8qxp_pxl2dpi_get_available_ep_from_port()` returns ERR_PTR on multiple error paths. So the original code:
```c
struct device_node *ep __free(device_node) =
imx8qxp_pxl2dpi_get_available_ep_from_port(p2d, 1);
if (IS_ERR(ep))
return PTR_ERR(ep);
```
would trigger `of_node_put()` on an ERR_PTR value when the function returns early on the error path, since `__free` runs at scope exit.
**Fix correctness:** The patch correctly:
1. Removes `__free(device_node)` from `ep`, making it a plain pointer.
2. Keeps the existing `IS_ERR(ep)` check — on this path, no cleanup is needed (ERR_PTR is not a real node).
3. Adds an explicit `of_node_put(ep)` after `of_graph_get_remote_port_parent(ep)` consumes the node.
4. Leaves `remote` with `__free(device_node)` — this is safe because `of_graph_get_remote_port_parent()` returns NULL on failure, never ERR_PTR.
```c
struct device_node *remote __free(device_node) = of_graph_get_remote_port_parent(ep);
of_node_put(ep);
```
The placement of `of_node_put(ep)` is correct: it's called after `ep` is consumed by `of_graph_get_remote_port_parent()` and before the function could return without releasing it.
**Minor observations:**
- The commit message is well-written and clearly explains the bug, the fix strategy, and why the approach was chosen (minimal for stable backport).
- The other caller, `imx8qxp_pxl2dpi_set_pixel_link_sel()`, already uses manual `of_node_put()` and is not affected by this bug.
- The Fixes tag correctly points to `ceea3f7806a10` which introduced the `__free(device_node)` annotation.
- The v5 changelog shows good iteration, with the author converging on the most minimal fix after exploring more invasive approaches in earlier versions.
**No issues found.** The patch is correct, minimal, and appropriate for stable.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-07 3:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 9:23 [PATCH v5] drm/bridge: imx8qxp-pxl2dpi: avoid ERR_PTR with device_node cleanup Guangshuo Li
2026-05-06 9:50 ` Liu Ying
2026-05-06 13:58 ` Guangshuo Li
2026-05-06 14:24 ` Guangshuo Li
2026-05-07 3:48 ` Claude Code Review Bot [this message]
2026-05-07 3:48 ` Claude review: " Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-05-06 14:24 [PATCH v6] " Guangshuo Li
2026-05-07 3:23 ` Claude review: " Claude Code Review Bot
2026-05-07 3:23 ` Claude Code Review Bot
2026-05-02 11:55 [PATCH v3] " Guangshuo Li
2026-05-04 22:50 ` Claude review: " Claude Code Review Bot
2026-05-04 22:50 ` 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-patch1-20260506092324.635014-1-lgs201920130244@gmail.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