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: dw_hdmi: Propagate bus format to display driver
Date: Sat, 16 May 2026 16:14:40 +1000	[thread overview]
Message-ID: <review-patch10-20260510183114.1248840-11-jonas@kwiboo.se> (raw)
In-Reply-To: <20260510183114.1248840-11-jonas@kwiboo.se>

Patch Review

**Status: Bug found**

This patch reads the negotiated bus format from the bridge state and maps it to the rockchip output mode (AAAA or YUV420).

**Bug**: In `dw_hdmi_rockchip_get_bus_format()`:

```c
bridge_state = drm_atomic_get_bridge_state(conn_state->state, bridge);
if (!bridge_state)
	return 0;
```

`drm_atomic_get_bridge_state()` returns `ERR_CAST()` on failure (i.e., `ERR_PTR`), **not** NULL. This NULL check will never catch an error. The code will proceed with an `ERR_PTR` value in `bridge_state` and dereference it, causing a crash.

This should be:
```c
if (IS_ERR(bridge_state))
	return 0;
```

Or better, since this is called from `atomic_check`, the error should be propagated:
```c
if (IS_ERR(bridge_state))
	return PTR_ERR(bridge_state);
```

But that would require changing the return type of `dw_hdmi_rockchip_get_bus_format()` to handle errors. The simplest safe fix is to use `IS_ERR(bridge_state)`.

**Minor**: The commit message has a typo: "inpact" should be "impact".

**Additional note**: The `__free(drm_bridge_put)` cleanup annotation on `bridge` is a nice use of scope-based resource management for the bridge reference obtained from `drm_bridge_chain_get_first_bridge()`.

The `MEDIA_BUS_FMT_FIXED` fallthrough to `MEDIA_BUS_FMT_RGB888_1X24` is the right default behavior. The switch covers RGB, YCbCr 4:4:4, and YCbCr 4:2:0 at both 8 and 10 bit depths.

The `s->bus_format = bus_format` assignment correctly propagates the format to `rockchip_crtc_state`, which has the `bus_format` field (verified in `rockchip_drm_drv.h`).

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-05-16  6:14 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-10 18:31 [PATCH 00/10] drm/rockchip: dw_hdmi: Misc cleanup and propagate bus format Jonas Karlman
2026-05-10 18:31 ` [PATCH 01/10] drm/rockchip: dw_hdmi: Use of_device_get_match_data() to get match data Jonas Karlman
2026-05-16  6:14   ` Claude review: " Claude Code Review Bot
2026-05-10 18:31 ` [PATCH 02/10] drm/rockchip: dw_hdmi: Use local dev variable consistently in bind() Jonas Karlman
2026-05-16  6:14   ` Claude review: " Claude Code Review Bot
2026-05-10 18:31 ` [PATCH 03/10] drm/rockchip: dw_hdmi: Use drmres helpers for encoder resources Jonas Karlman
2026-05-16  6:14   ` Claude review: " Claude Code Review Bot
2026-05-10 18:31 ` [PATCH 04/10] drm/rockchip: dw_hdmi: Inline resource lookup into bind() Jonas Karlman
2026-05-16  6:14   ` Claude review: " Claude Code Review Bot
2026-05-10 18:31 ` [PATCH 05/10] drm/rockchip: dw_hdmi: Hold a reference to the dw-hdmi bridge Jonas Karlman
2026-05-16  6:14   ` Claude review: " Claude Code Review Bot
2026-05-10 18:31 ` [PATCH 06/10] drm/rockchip: dw_hdmi: Remove empty encoder helper funcs Jonas Karlman
2026-05-16  6:14   ` Claude review: " Claude Code Review Bot
2026-05-10 18:31 ` [PATCH 07/10] drm/rockchip: dw_hdmi: Clean up whitespace Jonas Karlman
2026-05-16  6:14   ` Claude review: " Claude Code Review Bot
2026-05-10 18:31 ` [PATCH 08/10] drm/rockchip: dw_hdmi: Set output_port for RK3568/RK3566 Jonas Karlman
2026-05-16  6:14   ` Claude review: " Claude Code Review Bot
2026-05-10 18:31 ` [PATCH 09/10] drm/rockchip: dw_hdmi: Configure HDMI PHY in atomic_mode_set() Jonas Karlman
2026-05-16  6:14   ` Claude review: " Claude Code Review Bot
2026-05-10 18:31 ` [PATCH 10/10] drm/rockchip: dw_hdmi: Propagate bus format to display driver Jonas Karlman
2026-05-16  6:14   ` Claude Code Review Bot [this message]
2026-05-16  6:14 ` Claude review: drm/rockchip: dw_hdmi: Misc cleanup and propagate bus format 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-patch10-20260510183114.1248840-11-jonas@kwiboo.se \
    --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