Commit bf8cbae4 authored by Linas Vepstas's avatar Linas Vepstas Committed by Greg Kroah-Hartman

PCI: rpaphp: Cleanup flow of control for rpaphp_add_slot

Cleanup the flow of control for rpaphp_add_slot(), so as to
make it easier to read. The ext patch will fix a bug in this 
same code. 
Signed-off-by: default avatarLinas Vepstas <linas@austin.ibm.com>
Cc: John Rose <johnrose@austin.ibm.com>
Signed-off-by: default avatarKristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f14e3136
...@@ -299,32 +299,32 @@ int rpaphp_add_slot(struct device_node *dn) ...@@ -299,32 +299,32 @@ int rpaphp_add_slot(struct device_node *dn)
const int *indexes, *names, *types, *power_domains; const int *indexes, *names, *types, *power_domains;
char *name, *type; char *name, *type;
if (!dn->name || strcmp(dn->name, "pci"))
return 0;
if (!is_php_dn(dn, &indexes, &names, &types, &power_domains))
return 0;
dbg("Entry %s: dn->full_name=%s\n", __FUNCTION__, dn->full_name); dbg("Entry %s: dn->full_name=%s\n", __FUNCTION__, dn->full_name);
/* register PCI devices */ /* register PCI devices */
if (dn->name != 0 && strcmp(dn->name, "pci") == 0) { name = (char *) &names[1];
if (!is_php_dn(dn, &indexes, &names, &types, &power_domains)) type = (char *) &types[1];
goto exit; for (i = 0; i < indexes[0]; i++) {
name = (char *) &names[1]; slot = alloc_slot_struct(dn, indexes[i + 1], name, power_domains[i + 1]);
type = (char *) &types[1]; if (!slot)
for (i = 0; i < indexes[0]; i++, return -ENOMEM;
name += (strlen(name) + 1), type += (strlen(type) + 1)) {
slot->type = simple_strtoul(type, NULL, 10);
if (!(slot = alloc_slot_struct(dn, indexes[i + 1], name,
power_domains[i + 1]))) {
retval = -ENOMEM;
goto exit;
}
slot->type = simple_strtoul(type, NULL, 10);
dbg("Found drc-index:0x%x drc-name:%s drc-type:%s\n", dbg("Found drc-index:0x%x drc-name:%s drc-type:%s\n",
indexes[i + 1], name, type); indexes[i + 1], name, type);
retval = rpaphp_register_pci_slot(slot); retval = rpaphp_register_pci_slot(slot);
} name += strlen(name) + 1;
type += strlen(type) + 1;
} }
exit:
dbg("%s - Exit: num_slots=%d rc[%d]\n", dbg("%s - Exit: num_slots=%d rc[%d]\n",
__FUNCTION__, num_slots, retval); __FUNCTION__, num_slots, retval);
return retval; return retval;
......
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