提交 05013486 编写于 作者: B Bjorn Helgaas

PCI: Return early on allocation failures to unindent mainline code

On allocation failure, return early so the main body of the function
doesn't have to be indented as the body of an "if" statement.  No
functional change.
Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
上级 dc087f2f
...@@ -451,20 +451,21 @@ void pci_read_bridge_bases(struct pci_bus *child) ...@@ -451,20 +451,21 @@ void pci_read_bridge_bases(struct pci_bus *child)
} }
} }
static struct pci_bus * pci_alloc_bus(void) static struct pci_bus *pci_alloc_bus(void)
{ {
struct pci_bus *b; struct pci_bus *b;
b = kzalloc(sizeof(*b), GFP_KERNEL); b = kzalloc(sizeof(*b), GFP_KERNEL);
if (b) { if (!b)
INIT_LIST_HEAD(&b->node); return NULL;
INIT_LIST_HEAD(&b->children);
INIT_LIST_HEAD(&b->devices); INIT_LIST_HEAD(&b->node);
INIT_LIST_HEAD(&b->slots); INIT_LIST_HEAD(&b->children);
INIT_LIST_HEAD(&b->resources); INIT_LIST_HEAD(&b->devices);
b->max_bus_speed = PCI_SPEED_UNKNOWN; INIT_LIST_HEAD(&b->slots);
b->cur_bus_speed = PCI_SPEED_UNKNOWN; INIT_LIST_HEAD(&b->resources);
} b->max_bus_speed = PCI_SPEED_UNKNOWN;
b->cur_bus_speed = PCI_SPEED_UNKNOWN;
return b; return b;
} }
...@@ -485,11 +486,11 @@ static struct pci_host_bridge *pci_alloc_host_bridge(struct pci_bus *b) ...@@ -485,11 +486,11 @@ static struct pci_host_bridge *pci_alloc_host_bridge(struct pci_bus *b)
struct pci_host_bridge *bridge; struct pci_host_bridge *bridge;
bridge = kzalloc(sizeof(*bridge), GFP_KERNEL); bridge = kzalloc(sizeof(*bridge), GFP_KERNEL);
if (bridge) { if (!bridge)
INIT_LIST_HEAD(&bridge->windows); return NULL;
bridge->bus = b;
}
INIT_LIST_HEAD(&bridge->windows);
bridge->bus = b;
return bridge; return bridge;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册