* [PATCH next] drm/panel: himax-hx83121a: Fix NULL vs IS_ERR() check in probe()
@ 2026-04-10 10:12 Dan Carpenter
2026-04-11 10:03 ` Pengyu Luo
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2026-04-10 10:12 UTC (permalink / raw)
To: Pengyu Luo
Cc: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, dri-devel,
linux-kernel, kernel-janitors
The devm_drm_panel_alloc() function never returns NULL, it returns error
pointers on failure.
Fixes: a7c61963b727 ("drm/panel: Add Himax HX83121A panel driver")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
This email is a free service from the Smatch-CI project [smatch.sf.net].
drivers/gpu/drm/panel/panel-himax-hx83121a.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-himax-hx83121a.c b/drivers/gpu/drm/panel/panel-himax-hx83121a.c
index ebe643ba4184..bed79aa06f46 100644
--- a/drivers/gpu/drm/panel/panel-himax-hx83121a.c
+++ b/drivers/gpu/drm/panel/panel-himax-hx83121a.c
@@ -596,8 +596,8 @@ static int himax_probe(struct mipi_dsi_device *dsi)
ctx = devm_drm_panel_alloc(dev, struct himax, panel, &himax_panel_funcs,
DRM_MODE_CONNECTOR_DSI);
- if (!ctx)
- return -ENOMEM;
+ if (IS_ERR(ctx))
+ return PTR_ERR(ctx);
ret = devm_regulator_bulk_get_const(&dsi->dev,
ARRAY_SIZE(himax_supplies),
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH next] drm/panel: himax-hx83121a: Fix NULL vs IS_ERR() check in probe()
2026-04-10 10:12 [PATCH next] drm/panel: himax-hx83121a: Fix NULL vs IS_ERR() check in probe() Dan Carpenter
@ 2026-04-11 10:03 ` Pengyu Luo
2026-04-11 23:51 ` Claude review: " Claude Code Review Bot
2026-04-11 23:51 ` Claude Code Review Bot
2 siblings, 0 replies; 4+ messages in thread
From: Pengyu Luo @ 2026-04-11 10:03 UTC (permalink / raw)
To: Dan Carpenter
Cc: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, dri-devel,
linux-kernel, kernel-janitors
On Fri, Apr 10, 2026 at 6:12 PM Dan Carpenter <error27@gmail.com> wrote:
>
> The devm_drm_panel_alloc() function never returns NULL, it returns error
> pointers on failure.
>
> Fixes: a7c61963b727 ("drm/panel: Add Himax HX83121A panel driver")
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
Sorry, Chen Ni had sent it.
https://lore.kernel.org/dri-devel/20260327021728.647182-1-nichen@iscas.ac.cn/
--
Pengyu
^ permalink raw reply [flat|nested] 4+ messages in thread
* Claude review: drm/panel: himax-hx83121a: Fix NULL vs IS_ERR() check in probe()
2026-04-10 10:12 [PATCH next] drm/panel: himax-hx83121a: Fix NULL vs IS_ERR() check in probe() Dan Carpenter
2026-04-11 10:03 ` Pengyu Luo
@ 2026-04-11 23:51 ` Claude Code Review Bot
2026-04-11 23:51 ` Claude Code Review Bot
2 siblings, 0 replies; 4+ messages in thread
From: Claude Code Review Bot @ 2026-04-11 23:51 UTC (permalink / raw)
To: dri-devel-reviews
Overall Series Review
Subject: drm/panel: himax-hx83121a: Fix NULL vs IS_ERR() check in probe()
Author: Dan Carpenter <error27@gmail.com>
Patches: 2
Reviewed: 2026-04-12T09:51:38.596947
---
This is a single-patch fix from Dan Carpenter / Smatch-CI that corrects an error-checking bug in the himax-hx83121a panel driver's probe function. The fix is straightforward, correct, and well-justified.
The `devm_drm_panel_alloc()` macro wraps `__devm_drm_panel_alloc()`, which is documented in `include/drm/drm_panel.h:316` as returning "Pointer to container structure embedding the panel, **ERR_PTR on failure**." The original code incorrectly checks for `NULL` return, which can never happen — a failure would return an `ERR_PTR`, which is non-NULL and would sail past the `!ctx` check, leading to a crash or undefined behavior when the error pointer is subsequently dereferenced.
**Verdict: Patch looks good. Recommend applying.**
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 4+ messages in thread
* Claude review: drm/panel: himax-hx83121a: Fix NULL vs IS_ERR() check in probe()
2026-04-10 10:12 [PATCH next] drm/panel: himax-hx83121a: Fix NULL vs IS_ERR() check in probe() Dan Carpenter
2026-04-11 10:03 ` Pengyu Luo
2026-04-11 23:51 ` Claude review: " Claude Code Review Bot
@ 2026-04-11 23:51 ` Claude Code Review Bot
2 siblings, 0 replies; 4+ messages in thread
From: Claude Code Review Bot @ 2026-04-11 23:51 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Correctness: Good.** The fix changes:
```c
- if (!ctx)
- return -ENOMEM;
+ if (IS_ERR(ctx))
+ return PTR_ERR(ctx);
```
This is correct. The `devm_drm_panel_alloc()` header documentation at `include/drm/drm_panel.h:316` explicitly states it returns `ERR_PTR on failure`, never `NULL`. Using `IS_ERR()` / `PTR_ERR()` is the proper pattern, and is consistent with all other error checks in the same probe function (lines 609, 635, 650 all use `IS_ERR()`).
**Fixes tag:** The `Fixes:` tag referencing `a7c61963b727 ("drm/panel: Add Himax HX83121A panel driver")` is appropriate since the bug was introduced with the original driver addition.
**No issues found.** Clean, minimal, correct fix.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-04-11 23:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-10 10:12 [PATCH next] drm/panel: himax-hx83121a: Fix NULL vs IS_ERR() check in probe() Dan Carpenter
2026-04-11 10:03 ` Pengyu Luo
2026-04-11 23:51 ` Claude review: " Claude Code Review Bot
2026-04-11 23:51 ` 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