]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
PCI/VGA: Pass errors from pci_set_vga_state() up
authorSimon Richter <Simon.Richter@hogyros.de>
Sat, 7 Mar 2026 17:35:35 +0000 (02:35 +0900)
committerBjorn Helgaas <bhelgaas@google.com>
Wed, 25 Mar 2026 18:28:49 +0000 (13:28 -0500)
pci_set_vga_state() returns an error code, which so far has been ignored by
the only caller, __vga_tryget(), so forward it to the caller. As the return
type of __vga_tryget() is a pointer, wrap the error in ERR_PTR().

Signed-off-by: Simon Richter <Simon.Richter@hogyros.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/20260307173538.763188-3-Simon.Richter@hogyros.de
drivers/pci/vgaarb.c

index 22b2b6ebdefdb1e0d34a4b9603ccb8d824753a48..c360eee11dd9e85faf5603bee861160e4c1395f4 100644 (file)
@@ -215,6 +215,7 @@ static struct vga_device *__vga_tryget(struct vga_device *vgadev,
        struct vga_device *conflict;
        unsigned int pci_bits;
        u32 flags = 0;
+       int err;
 
        /*
         * Account for "normal" resources to lock. If we decode the legacy,
@@ -307,7 +308,9 @@ static struct vga_device *__vga_tryget(struct vga_device *vgadev,
                if (change_bridge)
                        flags |= PCI_VGA_STATE_CHANGE_BRIDGE;
 
-               pci_set_vga_state(conflict->pdev, false, pci_bits, flags);
+               err = pci_set_vga_state(conflict->pdev, false, pci_bits, flags);
+               if (err)
+                       return ERR_PTR(err);
                conflict->owns &= ~match;
 
                /* If we disabled normal decoding, reflect it in owns */
@@ -337,7 +340,9 @@ enable_them:
        if (wants & VGA_RSRC_LEGACY_MASK)
                flags |= PCI_VGA_STATE_CHANGE_BRIDGE;
 
-       pci_set_vga_state(vgadev->pdev, true, pci_bits, flags);
+       err = pci_set_vga_state(vgadev->pdev, true, pci_bits, flags);
+       if (err)
+               return ERR_PTR(err);
 
        vgadev->owns |= wants;
 lock_them:
@@ -455,6 +460,10 @@ int vga_get(struct pci_dev *pdev, unsigned int rsrc, int interruptible)
                }
                conflict = __vga_tryget(vgadev, rsrc);
                spin_unlock_irqrestore(&vga_lock, flags);
+               if (IS_ERR(conflict)) {
+                       rc = PTR_ERR(conflict);
+                       break;
+               }
                if (conflict == NULL)
                        break;