Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 07f9b61c authored by ethan.zhao's avatar ethan.zhao Committed by Bjorn Helgaas
Browse files

x86/PCI: MMCONFIG: Check earlier for MMCONFIG region at address zero



We can check for addr being zero earlier and thus avoid the mutex_unlock()
cleanup path.

[bhelgaas: drop warning printk]
Signed-off-by: default avatarethan.zhao <ethan.zhao@oracle.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Acked-by: default avatarYinghai Lu <yinghai@kernel.org>
parent 56039e65
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -700,7 +700,7 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,
	if (!(pci_probe & PCI_PROBE_MMCONF) || pci_mmcfg_arch_init_failed)
		return -ENODEV;

	if (start > end)
	if (start > end || !addr)
		return -EINVAL;

	mutex_lock(&pci_mmcfg_lock);
@@ -716,11 +716,6 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,
		return -EEXIST;
	}

	if (!addr) {
		mutex_unlock(&pci_mmcfg_lock);
		return -EINVAL;
	}

	rc = -EBUSY;
	cfg = pci_mmconfig_alloc(seg, start, end, addr);
	if (cfg == NULL) {