public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/virtgpu: Use ERR_PTR for fb_create callback error return
Date: Fri, 05 Jun 2026 06:40:48 +1000	[thread overview]
Message-ID: <review-patch1-20260604071202.138235-1-liuqiangneo@163.com> (raw)
In-Reply-To: <20260604071202.138235-1-liuqiangneo@163.com>

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

  reply	other threads:[~2026-06-04 20:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2026-06-04 20:40 ` Claude review: " Claude Code Review Bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=review-patch1-20260604071202.138235-1-liuqiangneo@163.com \
    --to=claude-review@example.com \
    --cc=dri-devel-reviews@example.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox