From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/mediatek: Convert legacy DRM logging to drm_* helpers in mtk_dsi.c
Date: Thu, 23 Apr 2026 10:21:29 +1000 [thread overview]
Message-ID: <review-patch1-20260420052008.5417-1-abhiraj21put@gmail.com> (raw)
In-Reply-To: <20260420052008.5417-1-abhiraj21put@gmail.com>
Patch Review
**Commit message error:**
> This change aligns the radeon driver with the DRM TODO item
This should say "mediatek driver", not "radeon driver". Copy-paste error.
**Bug: Declaration after statement (build break)**
At `mtk_dsi_switch_to_cmd_mode()`, the new variable is declared after executable statements:
```c
static s32 mtk_dsi_switch_to_cmd_mode(struct mtk_dsi *dsi, u8 irq_flag, u32 t)
{
mtk_dsi_irq_data_clear(dsi, irq_flag);
mtk_dsi_set_cmd_mode(dsi);
struct drm_device *drm = dsi->bridge.dev; // <-- after statements
```
The declaration must be moved to the top of the function, before the two function calls. This will fail to compile with `-Wdeclaration-after-statement -Werror`.
**Bug: NULL `bridge.dev` in `mtk_dsi_host_attach()` (potential NULL deref)**
```c
static int mtk_dsi_host_attach(struct mipi_dsi_host *host,
struct mipi_dsi_device *device)
{
struct mtk_dsi *dsi = host_to_dsi(host);
struct device *dev = host->dev;
struct drm_device *drm = dsi->bridge.dev; // <-- NULL here
...
drm_bridge_add(&dsi->bridge); // does NOT set bridge.dev
ret = component_add(host->dev, &mtk_dsi_component_ops);
if (ret) {
drm_err(drm, ...); // passes NULL drm_device
```
`bridge.dev` is set by `drm_bridge_attach()` (called inside `mtk_dsi_encoder_init()` which runs during `mtk_dsi_bind()`, triggered by the component framework *after* `component_add()`). At the point where `drm` is captured, it is NULL. The `drm_err(drm, ...)` call with a NULL first argument will crash. This call site should either keep using `DRM_ERROR()` or use `dev_err(host->dev, ...)` instead.
**Similarly suspect: `mtk_dsi_host_transfer()` and `mtk_dsi_wait_for_idle()`**
These functions also access `dsi->bridge.dev`. While `bridge.dev` is likely valid during normal runtime (the bridge should be attached by then), it's worth verifying that these code paths cannot be reached before the bridge is fully attached, or during teardown after `drm_bridge_detach()` has cleared `bridge.dev` to NULL.
**Minor: trailing `\n` in drm_* calls**
The `drm_*()` helpers already append a newline. The existing `DRM_*()` macros also append a newline, so the `\n` in the format strings was always redundant (producing double newlines). While this patch is just a mechanical conversion and isn't introducing the issue, it would be nice to clean up the trailing `\n` as part of this conversion.
**Correct conversions:**
The conversions in `mtk_dsi_config_vdo_timing_per_line_lp()`, `mtk_dsi_wait_for_irq_done()`, `mtk_dsi_bridge_atomic_pre_enable()`, and `mtk_dsi_encoder_init()` all look correct — `dsi->bridge.dev` or `bridge->dev` is valid in those contexts.
---
Generated by Claude Code Patch Reviewer
prev parent reply other threads:[~2026-04-23 0:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-20 5:20 [PATCH] drm/mediatek: Convert legacy DRM logging to drm_* helpers in mtk_dsi.c Abhishek Rajput
2026-04-23 0:21 ` Claude review: " Claude Code Review Bot
2026-04-23 0:21 ` Claude Code Review Bot [this message]
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-20260420052008.5417-1-abhiraj21put@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