Commit f1265983 authored by Bjorn Helgaas's avatar Bjorn Helgaas

x86/pci: Return pci_mmconfig_add() failure early

If pci_mmconfig_alloc() fails, return the failure early so it's obvious
that the failure is the exception, and the success is the normal case.  No
functional change intended.

Link: https://lore.kernel.org/r/20231121183643.249006-9-helgaas@kernel.orgTested-by: default avatarTomasz Pala <gotar@polanet.pl>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent f284dff4
...@@ -102,14 +102,15 @@ struct pci_mmcfg_region *__init pci_mmconfig_add(int segment, int start, ...@@ -102,14 +102,15 @@ struct pci_mmcfg_region *__init pci_mmconfig_add(int segment, int start,
struct pci_mmcfg_region *new; struct pci_mmcfg_region *new;
new = pci_mmconfig_alloc(segment, start, end, addr); new = pci_mmconfig_alloc(segment, start, end, addr);
if (new) { if (!new)
mutex_lock(&pci_mmcfg_lock); return NULL;
list_add_sorted(new);
mutex_unlock(&pci_mmcfg_lock);
pr_info("ECAM %pR (base %#lx) for domain %04x [bus %02x-%02x]\n", mutex_lock(&pci_mmcfg_lock);
&new->res, (unsigned long)addr, segment, start, end); list_add_sorted(new);
} mutex_unlock(&pci_mmcfg_lock);
pr_info("ECAM %pR (base %#lx) for domain %04x [bus %02x-%02x]\n",
&new->res, (unsigned long)addr, segment, start, end);
return new; return new;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment