From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: vgaarb: pass errors from pci_set_vga_state up Date: Wed, 18 Feb 2026 06:47:57 +1000 Message-ID: In-Reply-To: <20260217170419.236739-3-Simon.Richter@hogyros.de> References: <20260217170419.236739-1-Simon.Richter@hogyros.de> <20260217170419.236739-3-Simon.Richter@hogyros.de> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review This patch converts `__vga_tryget` to propagate `pci_set_vga_state` errors via `ERR_PTR`, and updates `vga_get` to handle the new error pointer returns. > + err = pci_set_vga_state(conflict->pdev, false, pci_bits, flags); > + if (unlikely(err)) > + return ERR_PTR(err); > conflict->owns &= ~match; When `pci_set_vga_state(conflict->pdev, false, ...)` fails, the function returns immediately. At this point, VGA state for the *requesting* device has not been enabled yet, and the conflict device's `owns` bits have not been updated, so the data structures remain consistent. However, if this is not the first iteration of the `list_for_each_entry` loop, earlier iterations may have already successfully disabled VGA on other conflicting devices (via `pci_set_vga_state(false)`) and cleared their `owns` bits. Those devices have lost VGA ownership in the software state and in hardware, but the requesting device never got it. This leaves the system in a state where nobody owns VGA. Is this an acceptable outcome, or should the series attempt to roll back the changes to previously-processed conflicts? > + if (IS_ERR(conflict)) > + { > + rc = PTR_ERR(conflict); > + break; > + } Same brace style issue. The `IS_ERR` check in `vga_get` is correct. However, `vga_tryget()` also calls `__vga_tryget` and is **not updated** by this patch: ```c if (__vga_tryget(vgadev, rsrc)) rc = -EBUSY; ``` After this patch, `__vga_tryget` can return `ERR_PTR(-EIO)` (or similar). Since `ERR_PTR` values are non-NULL and non-zero, this `if` evaluates to true and `vga_tryget` returns `-EBUSY` instead of the actual error code. This is a bug -- `vga_tryget` should be updated to distinguish between a real conflict (non-NULL, non-ERR pointer) and an error (ERR_PTR). Something like: ```c conflict = __vga_tryget(vgadev, rsrc); if (IS_ERR(conflict)) rc = PTR_ERR(conflict); else if (conflict) rc = -EBUSY; ``` --- Generated by Claude Code Patch Reviewer