From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm: renesas: rz-du: mipi_dsi: Fix return path on error
Date: Tue, 05 May 2026 09:27:22 +1000 [thread overview]
Message-ID: <review-patch1-20260501132135.196701-1-chris.brandt@renesas.com> (raw)
In-Reply-To: <20260501132135.196701-1-chris.brandt@renesas.com>
Patch Review
**Bug analysis**: In the original code, `dma_alloc_coherent()` was the last operation in `rzg2l_mipi_dsi_probe()`, placed after `mipi_dsi_host_register()`. On allocation failure it executed:
```c
return -ENOMEM;
```
This bypassed the error cleanup labels (`err_phy`, `err_pm_disable`), leaking the `pm_runtime_enable()` state and the registered MIPI DSI host.
**Fix correctness**:
The allocation is moved to before `platform_set_drvdata()` and `pm_runtime_enable()`:
```c
dsi->dcs_buf_virt = dmam_alloc_coherent(dsi->dev, RZG2L_DCS_BUF_SIZE,
&dsi->dcs_buf_phys, GFP_KERNEL);
if (!dsi->dcs_buf_virt)
return -ENOMEM;
```
At this point in the probe function, only `devm_*` managed resources have been acquired (clocks, resets, ioremap), so a plain `return` is safe — `devm` teardown handles everything. The switch from `dma_alloc_coherent` to `dmam_alloc_coherent` is the right choice: it's the device-managed variant, so the buffer is automatically freed when the device is unbound, eliminating the need for the explicit `dma_free_coherent()` in `remove()`.
**Remove path**: The `dma_free_coherent()` call is correctly removed from `rzg2l_mipi_dsi_remove()` since `dmam_alloc_coherent()` handles cleanup automatically.
**Device argument consistency**: The original code used `dsi->host.dev` as the device for `dma_alloc_coherent()` / `dma_free_coherent()`, while the new code uses `dsi->dev`. Looking at the probe function, `dsi->host.dev` is assigned to `dsi->dev` later in the function (line 1475: `dsi->host.dev = dsi->dev`), so using `dsi->dev` directly is correct and actually necessary since `dsi->host.dev` isn't set yet at the new call site.
**No issues found.** The patch is minimal, well-targeted, and correctly fixes both the immediate error-path bug and the broader resource management concern by using the managed API.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-04 23:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-01 13:21 [PATCH v3] drm: renesas: rz-du: mipi_dsi: Fix return path on error Chris Brandt
2026-05-04 23:27 ` Claude Code Review Bot [this message]
2026-05-04 23:27 ` Claude review: " Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-04-22 14:51 [PATCH v2] " Chris Brandt
2026-04-22 21:31 ` Claude review: " Claude Code Review Bot
2026-04-22 21:31 ` 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-20260501132135.196701-1-chris.brandt@renesas.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