struct vga_device *conflict;
unsigned int pci_bits;
u32 flags = 0;
+ int err;
/*
* Account for "normal" resources to lock. If we decode the legacy,
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 */
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:
}
conflict = __vga_tryget(vgadev, rsrc);
spin_unlock_irqrestore(&vga_lock, flags);
+ if (IS_ERR(conflict)) {
+ rc = PTR_ERR(conflict);
+ break;
+ }
if (conflict == NULL)
break;