public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] accel/ethosu propagate devm_drm_dev_alloc() error code
@ 2026-03-01  9:03 Alok Tiwari
  2026-03-03  4:00 ` Claude review: " Claude Code Review Bot
  2026-03-03  4:00 ` Claude Code Review Bot
  0 siblings, 2 replies; 3+ messages in thread
From: Alok Tiwari @ 2026-03-01  9:03 UTC (permalink / raw)
  To: robh, tomeu, ogabbay, tzimmermann, Frank.Li, dri-devel
  Cc: alok.a.tiwarilinux, alok.a.tiwari

devm_drm_dev_alloc() returns an ERR_PTR() on failure. Use PTR_ERR() rather
than always returning -ENOMEM so the probe path propagates the real error
code such as -ENOMEM, -EINVAL, and -ENODEV.

Fixes: 5a5e9c0228e6 ("accel: Add Arm Ethos-U NPU driver")
Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
---
 drivers/accel/ethosu/ethosu_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/accel/ethosu/ethosu_drv.c b/drivers/accel/ethosu/ethosu_drv.c
index 9992193d7338..196871ec2a06 100644
--- a/drivers/accel/ethosu/ethosu_drv.c
+++ b/drivers/accel/ethosu/ethosu_drv.c
@@ -337,7 +337,8 @@ static int ethosu_probe(struct platform_device *pdev)
 	ethosudev = devm_drm_dev_alloc(&pdev->dev, &ethosu_drm_driver,
 				       struct ethosu_device, base);
 	if (IS_ERR(ethosudev))
-		return -ENOMEM;
+		return PTR_ERR(ethosudev);
+
 	platform_set_drvdata(pdev, ethosudev);
 
 	dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(40));
-- 
2.50.1


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

* Claude review: accel/ethosu propagate devm_drm_dev_alloc() error code
  2026-03-01  9:03 [PATCH] accel/ethosu propagate devm_drm_dev_alloc() error code Alok Tiwari
@ 2026-03-03  4:00 ` Claude Code Review Bot
  2026-03-03  4:00 ` Claude Code Review Bot
  1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-03-03  4:00 UTC (permalink / raw)
  To: dri-devel-reviews

Overall Series Review

Subject: accel/ethosu propagate devm_drm_dev_alloc() error code
Author: Alok Tiwari <alok.a.tiwari@oracle.com>
Patches: 1
Reviewed: 2026-03-03T14:00:36.219557

---

This is a single, trivial, and correct bugfix patch. It changes a hardcoded `-ENOMEM` error return to properly propagate the actual error code from `devm_drm_dev_alloc()` using `PTR_ERR()`. The fix is appropriate since `devm_drm_dev_alloc()` can return various error codes (e.g., `-ENOMEM`, `-EINVAL`, `-ENODEV`), and callers should propagate whatever error it actually returned rather than assuming `-ENOMEM`.

The patch is clean, minimal, and well-described. No concerns.

---
Generated by Claude Code Patch Reviewer

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

* Claude review: accel/ethosu propagate devm_drm_dev_alloc() error code
  2026-03-01  9:03 [PATCH] accel/ethosu propagate devm_drm_dev_alloc() error code Alok Tiwari
  2026-03-03  4:00 ` Claude review: " Claude Code Review Bot
@ 2026-03-03  4:00 ` Claude Code Review Bot
  1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-03-03  4:00 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**Correctness: Good.**

The change from:
```c
if (IS_ERR(ethosudev))
    return -ENOMEM;
```
to:
```c
if (IS_ERR(ethosudev))
    return PTR_ERR(ethosudev);
```

is correct. `devm_drm_dev_alloc()` is a wrapper around `__devm_drm_dev_alloc()` which can fail for multiple reasons, so hardcoding `-ENOMEM` loses information. `PTR_ERR()` is the standard pattern for extracting the error code from an `ERR_PTR` value.

**Minor nits:**

- The added blank line between `return PTR_ERR(ethosudev);` and `platform_set_drvdata(...)` is fine stylistically but is a whitespace-only change beyond the fix itself. Not a problem.

- The subject line is missing a colon after the subsystem prefix — it reads `accel/ethosu propagate` rather than `accel/ethosu: propagate`. This doesn't affect the code but is a minor deviation from standard kernel commit message conventions.

**Verdict:** Reviewed-by worthy. A straightforward and correct fix.

---
Generated by Claude Code Patch Reviewer

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

end of thread, other threads:[~2026-03-03  4:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-01  9:03 [PATCH] accel/ethosu propagate devm_drm_dev_alloc() error code Alok Tiwari
2026-03-03  4:00 ` Claude review: " Claude Code Review Bot
2026-03-03  4:00 ` 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