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: bridge: Cadence: Add MHDP8501 DP/HDMI driver
Date: Sun, 12 Apr 2026 13:34:45 +1000	[thread overview]
Message-ID: <review-patch4-20260407-dcss-hdmi-upstreaming-v21-4-4681070ab82f@oss.nxp.com> (raw)
In-Reply-To: <20260407-dcss-hdmi-upstreaming-v21-4-4681070ab82f@oss.nxp.com>

Patch Review

This is the largest patch (~2244 lines across 6 files) and deserves the most scrutiny.

**Deprecated include:**
```c
#include <linux/of_device.h>
```
`of_device.h` is deprecated in recent kernels. Use `linux/of.h` and `linux/platform_device.h` instead.

**`cdns_mhdp8501_dt_parse` returns `true` on success:**
```c
return true;
```
But the caller checks `if (ret < 0)`. Since `true == 1`, which is `>= 0`, this works accidentally, but returning a boolean from a function that uses `int` return type and `-EINVAL` error codes is confusing. Should return `0` on success.

**Lane mapping validation is ineffective:**
```c
lane_value = (data_lanes[i] >= 0 && data_lanes[i] <= 3) ? data_lanes[i] : 0;
```
Since `data_lanes[i]` is `u32`, the `>= 0` check is always true. Also, silently clamping invalid values to 0 instead of returning an error is wrong — an invalid lane mapping in DT should be an error.

**`endpoint` device_node leak:**
```c
endpoint = of_graph_get_endpoint_by_regs(np, 1, -1);
// ... used but never of_node_put(endpoint)
```
Missing `of_node_put(endpoint)` — this leaks a refcount.

**`kmalloc_obj(*input_fmts)` usage:**
```c
input_fmts = kmalloc_obj(*input_fmts);
```
This uses the newer `kmalloc_obj` API which allocates based on the type of the argument. This should work but is worth verifying it compiles.

**`struct video_info` in `cdns_mhdp8501_device`:**
```c
struct video_info video_info;
```
This stores `bpc` and `color_fmt` in the device struct, but in the DP path these are only used between `atomic_check` and `atomic_enable`. This is fragile since atomic state should be the source of truth — storing it in the device struct means it could become stale. The HDMI path correctly uses `conn_state->hdmi` directly.

**DP `cdns_dp_check_link_state` accesses connector state unsafely:**
```c
conn_state = connector->state;
crtc = conn_state->crtc;
...
crtc_state = crtc->state;
```
Accessing `connector->state` and `crtc->state` outside of an atomic commit or without holding appropriate locks is racy. The same issue exists in `cdns_hdmi_handle_hotplug()`.

**HDMI `reset_pipe()` function:**
```c
static int reset_pipe(struct drm_crtc *crtc)
{
    state = drm_atomic_state_alloc(crtc->dev);
    ...
    crtc_state->connectors_changed = true;
    ret = drm_atomic_commit(state);
```
Performing a full modeset from a workqueue (hotplug handler) without `drm_modeset_lock_all` is problematic. The `drm_modeset_acquire_init(&ctx, 0)` is used but the retry loop for `-EDEADLK` is missing, which can cause deadlocks. Compare with `intel_display_reset_finish()` or `drm_client_modeset_commit_atomic()` for proper patterns.

**HDMI I2C adapter is limited but claims broad functionality:**
```c
static u32 cdns_hdmi_i2c_func(struct i2c_adapter *adapter)
{
    return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
}
```
But the `xfer` function only supports `SCDC_I2C_SLAVE_ADDRESS` (0x54). Advertising `I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL` when only a single slave address is supported is misleading.

**HDMI `cdns_hdmi_i2c_read` reads uninitialized vars:**
```c
static int cdns_hdmi_i2c_read(struct cdns_mhdp8501_device *mhdp,
                              struct i2c_msg *msgs, int num)
{
    u8 addr, offset, *buf, len;
    ...
    for (i = 0; i < num; i++) {
        if (msgs[i].flags & I2C_M_RD) {
            addr = msgs[i].addr;
            buf = msgs[i].buf;
            len = msgs[i].len;
        } else {
            offset = msgs[i].buf[0];
        }
    }
    msg[0] = addr;
```
If no message has `I2C_M_RD` set, `addr`, `buf`, and `len` are used uninitialized. There's no validation of message ordering.

**Missing `DRM_BRIDGE_OP_HDMI_AUDIO` for audio support**: The Kconfig selects `DRM_CDNS_AUDIO` but `bridge.ops` doesn't include `DRM_BRIDGE_OP_HDMI_AUDIO`, and no audio infoframe callbacks are implemented. Either drop the `DRM_CDNS_AUDIO` select or add audio support.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-04-12  3:34 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-07 14:31 [PATCH v21 0/8] Initial support Cadence MHDP8501(HDMI/DP) for i.MX8MQ Laurentiu Palcu
2026-04-07 14:31 ` [PATCH v21 1/8] soc: cadence: Create helper functions for Cadence MHDP Laurentiu Palcu
2026-04-12  3:34   ` Claude review: " Claude Code Review Bot
2026-04-07 14:31 ` [PATCH v21 2/8] drm: bridge: cadence: Update mhdp8546 mailbox access functions Laurentiu Palcu
2026-04-12  3:34   ` Claude review: " Claude Code Review Bot
2026-04-07 14:31 ` [PATCH v21 3/8] dt-bindings: display: bridge: Add Cadence MHDP8501 Laurentiu Palcu
2026-04-08  6:42   ` Krzysztof Kozlowski
2026-04-08  7:13     ` Laurentiu Palcu
2026-04-08  7:32       ` Krzysztof Kozlowski
2026-04-08 14:36         ` Laurentiu Palcu
2026-04-12  3:34   ` Claude review: " Claude Code Review Bot
2026-04-07 14:31 ` [PATCH v21 4/8] drm: bridge: Cadence: Add MHDP8501 DP/HDMI driver Laurentiu Palcu
2026-04-12  3:34   ` Claude Code Review Bot [this message]
2026-04-07 14:31 ` [PATCH v21 5/8] dt-bindings: phy: Add Freescale iMX8MQ DP and HDMI PHY Laurentiu Palcu
2026-04-12  3:34   ` Claude review: " Claude Code Review Bot
2026-04-07 14:31 ` [PATCH v21 6/8] phy: freescale: Add DisplayPort/HDMI Combo-PHY driver for i.MX8MQ Laurentiu Palcu
2026-04-12  3:34   ` Claude review: " Claude Code Review Bot
2026-04-07 14:31 ` [PATCH v21 7/8] arm64: dts: imx8mq: Add DCSS + HDMI/DP display pipeline Laurentiu Palcu
2026-04-12  3:34   ` Claude review: " Claude Code Review Bot
2026-04-07 14:31 ` [PATCH v21 8/8] arm64: dts: imx8mq: tqma8mq-mba8mx: Enable HDMI support Laurentiu Palcu
2026-04-12  3:34   ` Claude review: " Claude Code Review Bot
2026-04-08  6:38 ` [PATCH v21 0/8] Initial support Cadence MHDP8501(HDMI/DP) for i.MX8MQ Krzysztof Kozlowski
2026-04-12  3:34 ` 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-patch4-20260407-dcss-hdmi-upstreaming-v21-4-4681070ab82f@oss.nxp.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