PCI/VGA: Pass errors from pci_set_vga_state() up
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
This commit is contained in:
parent
2a93c9851b
commit
94555ea9a0
1 changed files with 11 additions and 2 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue