* [PATCH v1] drm/panel: ili9881c: remove panel on DSI attach failure
@ 2026-04-20 6:34 Myeonghun Pak
2026-04-23 0:16 ` Claude review: " Claude Code Review Bot
2026-04-23 0:16 ` Claude Code Review Bot
0 siblings, 2 replies; 3+ messages in thread
From: Myeonghun Pak @ 2026-04-20 6:34 UTC (permalink / raw)
To: Neil Armstrong
Cc: Myeonghun Pak, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, dri-devel,
linux-kernel, Ijae Kim, Taegyu Kim, Yuho Choi
The probe path calls drm_panel_add() before mipi_dsi_attach().
If mipi_dsi_attach() fails, the driver returns without calling
drm_panel_remove(), leaving the panel registered in the global DRM
panel list. The driver's .remove() callback does not handle this case
because failed probe does not transition through the normal bound-device
removal path.
Fix this by unwinding drm_panel_add() when mipi_dsi_attach() fails.
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Co-developed-by: Taegyu Kim <tmk5904@psu.edu>
Signed-off-by: Taegyu Kim <tmk5904@psu.edu>
Co-developed-by: Yuho Choi <dbgh9129@gmail.com>
Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
index 947b47841..be5e58658 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -2359,7 +2359,13 @@ static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)
dsi->format = MIPI_DSI_FMT_RGB888;
dsi->lanes = ctx->desc->lanes;
- return mipi_dsi_attach(dsi);
+ ret = mipi_dsi_attach(dsi);
+ if (ret) {
+ drm_panel_remove(&ctx->panel);
+ return ret;
+ }
+
+ return 0;
}
static void ili9881c_dsi_remove(struct mipi_dsi_device *dsi)
--
2.47.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Claude review: drm/panel: ili9881c: remove panel on DSI attach failure
2026-04-20 6:34 [PATCH v1] drm/panel: ili9881c: remove panel on DSI attach failure Myeonghun Pak
@ 2026-04-23 0:16 ` Claude Code Review Bot
2026-04-23 0:16 ` Claude Code Review Bot
1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-04-23 0:16 UTC (permalink / raw)
To: dri-devel-reviews
Overall Series Review
Subject: drm/panel: ili9881c: remove panel on DSI attach failure
Author: Myeonghun Pak <mhun512@gmail.com>
Patches: 1
Reviewed: 2026-04-23T10:16:30.945213
---
This is a single-patch series that fixes a real resource cleanup bug in the `panel-ilitek-ili9881c` driver. When `mipi_dsi_attach()` fails during probe, the driver previously returned the error directly without calling `drm_panel_remove()`, leaving a stale panel registered in the global DRM panel list. The fix is correct, minimal, and follows established patterns seen in other DRM panel drivers.
**Verdict: The patch is correct and ready to merge with minor nits.**
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 3+ messages in thread
* Claude review: drm/panel: ili9881c: remove panel on DSI attach failure
2026-04-20 6:34 [PATCH v1] drm/panel: ili9881c: remove panel on DSI attach failure Myeonghun Pak
2026-04-23 0:16 ` Claude review: " Claude Code Review Bot
@ 2026-04-23 0:16 ` Claude Code Review Bot
1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-04-23 0:16 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Bug analysis:** The commit message accurately describes the problem. Looking at the probe function at `panel-ilitek-ili9881c.c:2313`, `drm_panel_add()` is called at line 2356 and then `mipi_dsi_attach()` at what was previously the tail-call `return mipi_dsi_attach(dsi)`. If `mipi_dsi_attach()` failed, `drm_panel_remove()` was never called — the `.remove()` callback at line 2371 wouldn't fire because probe never completed successfully.
**Code review:**
The fix is straightforward and correct:
```c
ret = mipi_dsi_attach(dsi);
if (ret) {
drm_panel_remove(&ctx->panel);
return ret;
}
return 0;
```
This properly unwinds the `drm_panel_add()` on the error path and matches the cleanup order in `ili9881c_dsi_remove()` (line 2371–2377), which calls `mipi_dsi_detach()` then `drm_panel_remove()`. Here only `drm_panel_remove()` is needed since `mipi_dsi_attach()` failed, so there's nothing to detach.
**Nits / observations:**
1. **No `drm_panel_of_backlight` cleanup?** At line 2352–2354, `drm_panel_of_backlight()` is called before `drm_panel_add()`. If `mipi_dsi_attach()` fails, the backlight acquired there is not explicitly cleaned up either. However, since the panel is allocated with `devm_drm_panel_alloc()` (line 2318), and the regulator/GPIO resources use `devm_` helpers, all device-managed resources will be released automatically when probe fails. So this is fine — the backlight registration is also devm-managed. This is not a problem with this patch.
2. **Commit message formatting:** The blank line between "If mipi_dsi_attach() fails, the driver returns without calling" and "drm_panel_remove()..." at lines 102–103 of the mbox appears to be an unintentional line break splitting a sentence across paragraphs. This should be reflowed into a single paragraph for the final commit message.
3. **The fix pattern is well-established.** Many other DRM panel drivers (e.g., `panel-boe-tv101wum-nl6.c`, `panel-novatek-nt35510.c`) use the same pattern of cleaning up `drm_panel_add()` on `mipi_dsi_attach()` failure.
**Overall:** This is a correct, minimal bug fix. The only actionable feedback is the commit message formatting nit (the spurious blank line splitting a sentence). The code change itself is clean and appropriate.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-23 0:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-20 6:34 [PATCH v1] drm/panel: ili9881c: remove panel on DSI attach failure Myeonghun Pak
2026-04-23 0:16 ` Claude review: " Claude Code Review Bot
2026-04-23 0:16 ` Claude Code Review Bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox