From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: vgaarb: pass errors from pci_set_vga_state() up
Date: Mon, 09 Mar 2026 08:05:36 +1000 [thread overview]
Message-ID: <review-patch2-20260307173538.763188-3-Simon.Richter@hogyros.de> (raw)
In-Reply-To: <20260307173538.763188-3-Simon.Richter@hogyros.de>
Patch Review
**Verdict: Correct but has a concern.**
The approach of wrapping the error in `ERR_PTR()` to fit the existing pointer return type of `__vga_tryget()` is reasonable. The `vga_get()` caller is properly updated with `IS_ERR()`/`PTR_ERR()` checks.
However, there is a missed caller: `vga_tryget()` at `drivers/pci/vgaarb.c:529`:
```c
if (__vga_tryget(vgadev, rsrc))
rc = -EBUSY;
```
After this patch, `__vga_tryget()` can return `ERR_PTR(-EIO)` (or other error pointers). Since `ERR_PTR()` returns a non-NULL pointer, this truthiness check won't crash — it correctly enters the error branch. But it will unconditionally report `-EBUSY` instead of the actual error code (e.g., `-EIO`). This masks the real failure reason. It should be updated to something like:
```c
conflict = __vga_tryget(vgadev, rsrc);
if (IS_ERR(conflict))
rc = PTR_ERR(conflict);
else if (conflict)
rc = -EBUSY;
```
**State inconsistency concern:** When `pci_set_vga_state()` fails while disabling a conflicting device (line 311-313), the function returns immediately. At this point, earlier conflicting devices in the loop iteration may have already had their VGA state disabled and their `owns` bits cleared (line 314). When the error propagates up and `vga_get()` breaks out of its loop, no rollback occurs — those previously-disabled conflicts remain disabled with no owner. This is arguably acceptable since the alternative (complex rollback logic) is fragile, and the VGA arbiter state may self-correct on the next successful `vga_get()`. But it's worth the author considering whether a `dev_warn()` or similar diagnostic would be appropriate when this happens.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-03-08 22:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-07 17:35 [PATCH v3 0/5] Bridges without VGA support Simon Richter
2026-03-07 17:35 ` [PATCH v3 1/5] vgaarb: pass vga_get_uninterruptible() errors to userspace Simon Richter
2026-03-08 22:05 ` Claude review: " Claude Code Review Bot
2026-03-07 17:35 ` [PATCH v3 2/5] vgaarb: pass errors from pci_set_vga_state() up Simon Richter
2026-03-08 22:05 ` Claude Code Review Bot [this message]
2026-03-07 17:35 ` [PATCH v3 3/5] vgaarb: mark vga_get() and wrappers as __must_check Simon Richter
2026-03-08 22:05 ` Claude review: " Claude Code Review Bot
2026-03-07 17:35 ` [PATCH v3 4/5] pci: check if VGA decoding was really activated Simon Richter
2026-03-08 22:05 ` Claude review: " Claude Code Review Bot
2026-03-07 17:35 ` [PATCH v3 5/5] pci: mark pci_set_vga_state() as __must_check Simon Richter
2026-03-08 22:05 ` Claude review: " Claude Code Review Bot
2026-03-08 22:05 ` Claude review: Bridges without VGA support Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-02-17 17:04 [PATCH 0/5] bridges " Simon Richter
2026-02-17 17:04 ` [PATCH 2/5] vgaarb: pass errors from pci_set_vga_state up Simon Richter
2026-02-17 20:47 ` 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-patch2-20260307173538.763188-3-Simon.Richter@hogyros.de \
--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