public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/virtgpu: Use ERR_PTR for fb_create callback error return
@ 2026-06-04  7:11 liuqiangneo
  2026-06-04 20:40 ` Claude review: " Claude Code Review Bot
  2026-06-04 20:40 ` Claude Code Review Bot
  0 siblings, 2 replies; 3+ messages in thread
From: liuqiangneo @ 2026-06-04  7:11 UTC (permalink / raw)
  To: airlied, kraxel, dmitry.osipenko
  Cc: gurchetansingh, olvaffe, maarten.lankhorst, mripard, tzimmermann,
	simona, dri-devel, virtualization, linux-kernel, Qiang Liu

From: Qiang Liu <liuqiang@kylinos.cn>

The fb_create callback returns an error code encoded with ERR_PTR()
on failure. This lets the caller see the actual error code instead of
just a generic failure.

Signed-off-by: Qiang Liu <liuqiang@kylinos.cn>
---
 drivers/gpu/drm/virtio/virtgpu_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
index 44ffffec550f..85ea252c658e 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -344,7 +344,7 @@ virtio_gpu_user_framebuffer_create(struct drm_device *dev,
 	if (ret) {
 		kfree(virtio_gpu_fb);
 		drm_gem_object_put(obj);
-		return NULL;
+		return ERR_PTR(ret);
 	}
 
 	return &virtio_gpu_fb->base;
-- 
2.43.0


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

* Claude review: drm/virtgpu: Use ERR_PTR for fb_create callback error return
  2026-06-04  7:11 [PATCH] drm/virtgpu: Use ERR_PTR for fb_create callback error return liuqiangneo
@ 2026-06-04 20:40 ` Claude Code Review Bot
  2026-06-04 20:40 ` Claude Code Review Bot
  1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-06-04 20:40 UTC (permalink / raw)
  To: dri-devel-reviews

Overall Series Review

Subject: drm/virtgpu: Use ERR_PTR for fb_create callback error return
Author: liuqiangneo@163.com
Patches: 1
Reviewed: 2026-06-05T06:40:48.679987

---

This is a single-patch series that fixes a real bug in the `virtio_gpu_user_framebuffer_create` function. The `fb_create` callback contract (documented in `drm_mode_config.h:78-81`) explicitly states it must return "a negative error code encoded with ERR_PTR()" on failure. However, one error path was returning `NULL` instead, which violates this contract and would cause the DRM core caller to misinterpret the error.

The fix is correct, minimal, and consistent with the other error paths in the same function, which all already use `ERR_PTR()`. This is a clear bug fix — **recommend accepting**.

---
Generated by Claude Code Patch Reviewer

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

* Claude review: drm/virtgpu: Use ERR_PTR for fb_create callback error return
  2026-06-04  7:11 [PATCH] drm/virtgpu: Use ERR_PTR for fb_create callback error return liuqiangneo
  2026-06-04 20:40 ` Claude review: " Claude Code Review Bot
@ 2026-06-04 20:40 ` Claude Code Review Bot
  1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-06-04 20:40 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**Correctness: Good.** The `fb_create` callback's return contract is documented in `include/drm/drm_mode_config.h:78-81`:

> RETURNS: A new framebuffer with an initial reference count of 1 or a negative error code encoded with ERR_PTR().

The caller in the DRM core will use `IS_ERR()` to check the return value. Returning `NULL` instead of `ERR_PTR()` means the caller would not detect the error — it would treat `NULL` as a valid framebuffer pointer, leading to a null pointer dereference.

**Consistency: Good.** Looking at the patched function (`virtgpu_display.c:318-351`), the three other error paths in `virtio_gpu_user_framebuffer_create` already return `ERR_PTR()` correctly:

```c
return ERR_PTR(-ENOENT);   // line 330 - bad pixel format
return ERR_PTR(-EINVAL);   // line 335 - object lookup failure
return ERR_PTR(-ENOMEM);   // line 340 - allocation failure
```

Only the `virtio_gpu_framebuffer_init` failure path (the one being fixed) was inconsistent, returning `NULL`. The fix changes it to `ERR_PTR(ret)`, which correctly propagates the actual error code from `virtio_gpu_framebuffer_init`.

**No issues found.** Clean, minimal, correct fix.

---
Generated by Claude Code Patch Reviewer

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

end of thread, other threads:[~2026-06-04 20:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-04  7:11 [PATCH] drm/virtgpu: Use ERR_PTR for fb_create callback error return liuqiangneo
2026-06-04 20:40 ` Claude review: " Claude Code Review Bot
2026-06-04 20:40 ` 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