From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/bridge: imx: Add i.MX93 parallel display format configuration support
Date: Tue, 03 Mar 2026 13:09:10 +1000 [thread overview]
Message-ID: <review-patch2-20260302-v6-18-topic-imx93-parallel-display-v10-2-634fe2778c7a@pengutronix.de> (raw)
In-Reply-To: <20260302-v6-18-topic-imx93-parallel-display-v10-2-634fe2778c7a@pengutronix.de>
Patch Review
**Subject:** `[PATCH v10 2/3] drm/bridge: imx: Add i.MX93 parallel display format configuration support`
This is the main driver patch. Several issues:
**Bug: `kmalloc_obj` used with dereference of uninitialized pointer**
```c
input_fmts = kmalloc_obj(*input_fmts, GFP_KERNEL);
```
`kmalloc_obj` takes a `VAR_OR_TYPE` as its first argument and uses `typeof(VAR_OR_TYPE)` internally to determine the allocation size. Here `*input_fmts` is a dereference of the `u32 *input_fmts` pointer, which at this point is uninitialized. While `kmalloc_obj` uses only `typeof()` (so the value is never actually read at runtime - the compiler extracts the type at compile time), dereferencing an uninitialized pointer in the source expression is arguably UB by the letter of the C standard, even inside `typeof()`. More practically, this is confusing to read. The more idiomatic form would be:
```c
input_fmts = kmalloc_obj(u32, GFP_KERNEL);
```
or simply using `kmalloc(sizeof(*input_fmts), GFP_KERNEL)` / `kmalloc(sizeof(u32), GFP_KERNEL)` which is the traditional pattern used throughout the DRM bridge subsystem.
**Missing `default` in switch statement in `atomic_enable`:**
```c
switch (bridge_state->output_bus_cfg.format) {
case MEDIA_BUS_FMT_RGB888_1X24:
case MEDIA_BUS_FMT_FIXED:
val = FORMAT_RGB888_TO_RGB888;
...
break;
case MEDIA_BUS_FMT_RGB666_1X18:
val = FORMAT_RGB888_TO_RGB666;
break;
case MEDIA_BUS_FMT_RGB565_1X16:
val = FORMAT_RGB565_TO_RGB565;
break;
}
```
If the format is something unexpected, `val` is used uninitialized in the `regmap_update_bits()` call below. The `atomic_check` should prevent this, but defensive programming would add a `default:` case (perhaps with a `dev_warn` + `return`). At minimum, initialize `val` to a sane default (e.g., `FORMAT_RGB888_TO_RGB888`).
**`imx93_pdfc_bridge_attach` uses `bridge->encoder` instead of the `encoder` parameter:**
```c
static int
imx93_pdfc_bridge_attach(struct drm_bridge *bridge, struct drm_encoder *encoder,
enum drm_bridge_attach_flags flags)
{
return drm_bridge_attach(bridge->encoder, bridge->next_bridge, bridge, flags);
}
```
The function receives `encoder` as a parameter but passes `bridge->encoder` to `drm_bridge_attach()`. Looking at other drivers in the same directory (e.g., `imx8mp-hdmi-pvi.c`), the convention is to pass the `encoder` parameter directly:
```c
return drm_bridge_attach(encoder, pvi->bridge.next_bridge, bridge, flags);
```
While `bridge->encoder` should be set by the time `attach` is called, using the function parameter `encoder` is the correct and idiomatic pattern. This should be changed.
**Missing `nxp,imx91-pdfc` in the of_device_id table:**
The DT binding in patch 1 documents `nxp,imx91-pdfc` as a valid compatible string, but the driver only matches:
```c
static const struct of_device_id imx93_pdfc_dt_ids[] = {
{ .compatible = "nxp,imx93-pdfc", },
{ /* sentinel */ }
};
```
If i.MX91 uses the same register layout (as stated in the cover letter), a second entry `{ .compatible = "nxp,imx91-pdfc", }` should be added. Without it, the driver won't probe on i.MX91-based device trees using the `nxp,imx91-pdfc` compatible.
**Kconfig: Missing `COMPILE_TEST` dependency:**
```
config DRM_IMX93_PARALLEL_DISP_FMT_CONVERTER
tristate "NXP i.MX91/i.MX93 parallel display format converter"
depends on OF
```
Other entries in this Kconfig are inside an `if ARCH_MXC || COMPILE_TEST` block, so this inherits that guard. However, the `depends on OF` is redundant since `ARCH_MXC` already selects `OF`. Not a blocker, just a nit consistent with how other entries in the file are structured.
**Verdict:** Needs fixes for the `bridge->encoder` vs `encoder` parameter issue and the missing `nxp,imx91-pdfc` compatible. The `kmalloc_obj(*input_fmts, ...)` usage and missing `default` in the switch are worth addressing too.
---
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-03-03 3:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-02 16:10 [PATCH v10 0/3] Add i.MX91/93 parallel display support Marco Felsch
2026-03-02 16:10 ` [PATCH v10 1/3] dt-bindings: soc: imx93-media-blk-ctrl: Add PDFC subnode to schema and example Marco Felsch
2026-03-03 3:09 ` Claude review: " Claude Code Review Bot
2026-03-02 16:10 ` [PATCH v10 2/3] drm/bridge: imx: Add i.MX93 parallel display format configuration support Marco Felsch
2026-03-03 3:09 ` Claude Code Review Bot [this message]
2026-03-02 16:10 ` [PATCH v10 3/3] arm64: dts: imx93: Add parallel display output nodes Marco Felsch
2026-03-03 3:09 ` Claude review: " Claude Code Review Bot
2026-03-03 3:04 ` [PATCH v10 0/3] Add i.MX91/93 parallel display support Liu Ying
2026-03-03 3:09 ` Claude review: " Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-03-03 10:34 [PATCH v11 0/3] " Marco Felsch
2026-03-03 10:34 ` [PATCH v11 2/3] drm/bridge: imx: Add i.MX93 parallel display format configuration support Marco Felsch
2026-03-03 21:36 ` 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-patch2-20260302-v6-18-topic-imx93-parallel-display-v10-2-634fe2778c7a@pengutronix.de \
--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