Skip to content

Commit

Permalink
x86/PCI: MMCONFIG: Check earlier for MMCONFIG region at address zero
Browse files Browse the repository at this point in the history
We can check for addr being zero earlier and thus avoid the mutex_unlock()
cleanup path.

[bhelgaas: drop warning printk]
Signed-off-by: ethan.zhao <ethan.zhao@oracle.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
  • Loading branch information
ethan.zhao authored and Bjorn Helgaas committed Jul 26, 2013
1 parent 56039e6 commit 07f9b61
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions arch/x86/pci/mmconfig-shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand Down

0 comments on commit 07f9b61

Please sign in to comment.