public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/panel: focaltech-ota7290b: Fix error check for devm_drm_panel_alloc()
@ 2026-04-29  8:05 Chen Ni
  2026-04-30  9:45 ` neil.armstrong
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chen Ni @ 2026-04-29  8:05 UTC (permalink / raw)
  To: neil.armstrong, jesszhan0024; +Cc: dmitry.baryshkov, linusw, dri-devel, Chen Ni

The devm_drm_panel_alloc() function returns an error pointer on failure,
not NULL. Fix the check to use IS_ERR() and return PTR_ERR() to
correctly handle allocation failures.

Fixes: 07853e954248 ("drm/panel: add driver for Waveshare 8.8" DSI TOUCH-A panel")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 drivers/gpu/drm/panel/panel-focaltech-ota7290b.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-focaltech-ota7290b.c b/drivers/gpu/drm/panel/panel-focaltech-ota7290b.c
index dd420bb19440..ed02a8daf96f 100644
--- a/drivers/gpu/drm/panel/panel-focaltech-ota7290b.c
+++ b/drivers/gpu/drm/panel/panel-focaltech-ota7290b.c
@@ -156,8 +156,8 @@ static int ota7290b_probe(struct mipi_dsi_device *dsi)
 	ctx = devm_drm_panel_alloc(&dsi->dev, struct ota7290b, panel,
 				   &ota7290b_funcs,
 				   DRM_MODE_CONNECTOR_DSI);
-	if (!ctx)
-		return -ENOMEM;
+	if (IS_ERR(ctx))
+		return PTR_ERR(ctx);
 	mipi_dsi_set_drvdata(dsi, ctx);
 	ctx->dsi = dsi;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/panel: focaltech-ota7290b: Fix error check for devm_drm_panel_alloc()
  2026-04-29  8:05 [PATCH] drm/panel: focaltech-ota7290b: Fix error check for devm_drm_panel_alloc() Chen Ni
@ 2026-04-30  9:45 ` neil.armstrong
  2026-05-05  1:48 ` Claude review: " Claude Code Review Bot
  2026-05-05  1:48 ` Claude Code Review Bot
  2 siblings, 0 replies; 4+ messages in thread
From: neil.armstrong @ 2026-04-30  9:45 UTC (permalink / raw)
  To: Chen Ni, jesszhan0024; +Cc: dmitry.baryshkov, linusw, dri-devel

On 4/29/26 10:05, Chen Ni wrote:
> The devm_drm_panel_alloc() function returns an error pointer on failure,
> not NULL. Fix the check to use IS_ERR() and return PTR_ERR() to
> correctly handle allocation failures.
> 
> Fixes: 07853e954248 ("drm/panel: add driver for Waveshare 8.8" DSI TOUCH-A panel")
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
> ---
>   drivers/gpu/drm/panel/panel-focaltech-ota7290b.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-focaltech-ota7290b.c b/drivers/gpu/drm/panel/panel-focaltech-ota7290b.c
> index dd420bb19440..ed02a8daf96f 100644
> --- a/drivers/gpu/drm/panel/panel-focaltech-ota7290b.c
> +++ b/drivers/gpu/drm/panel/panel-focaltech-ota7290b.c
> @@ -156,8 +156,8 @@ static int ota7290b_probe(struct mipi_dsi_device *dsi)
>   	ctx = devm_drm_panel_alloc(&dsi->dev, struct ota7290b, panel,
>   				   &ota7290b_funcs,
>   				   DRM_MODE_CONNECTOR_DSI);
> -	if (!ctx)
> -		return -ENOMEM;
> +	if (IS_ERR(ctx))
> +		return PTR_ERR(ctx);
>   	mipi_dsi_set_drvdata(dsi, ctx);
>   	ctx->dsi = dsi;
>   

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

Thanks,
Neil

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Claude review: drm/panel: focaltech-ota7290b: Fix error check for devm_drm_panel_alloc()
  2026-04-29  8:05 [PATCH] drm/panel: focaltech-ota7290b: Fix error check for devm_drm_panel_alloc() Chen Ni
  2026-04-30  9:45 ` neil.armstrong
@ 2026-05-05  1:48 ` Claude Code Review Bot
  2026-05-05  1:48 ` Claude Code Review Bot
  2 siblings, 0 replies; 4+ messages in thread
From: Claude Code Review Bot @ 2026-05-05  1:48 UTC (permalink / raw)
  To: dri-devel-reviews

Overall Series Review

Subject: drm/panel: focaltech-ota7290b: Fix error check for devm_drm_panel_alloc()
Author: Chen Ni <nichen@iscas.ac.cn>
Patches: 2
Reviewed: 2026-05-05T11:48:20.738806

---

This is a single-patch fix for an incorrect error check on `devm_drm_panel_alloc()` in the Focaltech OTA7290B panel driver. The fix is **correct and necessary**.

`devm_drm_panel_alloc()` (defined in `include/drm/drm_panel.h:318`) wraps `__devm_drm_panel_alloc()`, which returns `ERR_PTR(-EINVAL)` when `funcs` is NULL and `ERR_PTR(err)` when `devm_add_action_or_reset()` fails (`drm_panel.c:411,424`). It never returns NULL. The existing `!ctx` / `-ENOMEM` check would silently pass through error pointers, leading to a kernel oops on the subsequent dereference at `mipi_dsi_set_drvdata(dsi, ctx)`.

**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: focaltech-ota7290b: Fix error check for devm_drm_panel_alloc()
  2026-04-29  8:05 [PATCH] drm/panel: focaltech-ota7290b: Fix error check for devm_drm_panel_alloc() Chen Ni
  2026-04-30  9:45 ` neil.armstrong
  2026-05-05  1:48 ` Claude review: " Claude Code Review Bot
@ 2026-05-05  1:48 ` Claude Code Review Bot
  2 siblings, 0 replies; 4+ messages in thread
From: Claude Code Review Bot @ 2026-05-05  1:48 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**Status: Correct**

The change:
```c
-	if (!ctx)
-		return -ENOMEM;
+	if (IS_ERR(ctx))
+		return PTR_ERR(ctx);
```

This is the standard error-handling pattern for functions returning `ERR_PTR`. The header documentation at `drm_panel.h:316` explicitly states:

> Returns: Pointer to container structure embedding the panel, ERR_PTR on failure.

The Fixes tag references `07853e954248 ("drm/panel: add driver for Waveshare 8.8" DSI TOUCH-A panel")` which is the commit that introduced the driver with this bug.

**Minor observations:**
- The commit message is clear and accurate.
- The Fixes tag is appropriate since this is a real bug in the original driver commit.
- No other issues with the surrounding code visible in the diff context.

**No changes requested.**

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-05-05  1:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-29  8:05 [PATCH] drm/panel: focaltech-ota7290b: Fix error check for devm_drm_panel_alloc() Chen Ni
2026-04-30  9:45 ` neil.armstrong
2026-05-05  1:48 ` Claude review: " Claude Code Review Bot
2026-05-05  1:48 ` 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