Commit 4e3b369f authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Greg Kroah-Hartman

[PATCH] PCI Hotplug: Don't up() twice in acpiphp

On the error path, we currently try to up() a semaphore twice.
There was also a typo in an error message.
parent 25a3a555
...@@ -1243,40 +1243,38 @@ int acpiphp_disable_slot(struct acpiphp_slot *slot) ...@@ -1243,40 +1243,38 @@ int acpiphp_disable_slot(struct acpiphp_slot *slot)
/** /**
* acpiphp_check_bridge - re-enumerate devices * acpiphp_check_bridge - re-enumerate devices
*
* Iterate over all slots under this bridge and make sure that if a
* card is present they are enabled, and if not they are disabled.
*/ */
int acpiphp_check_bridge(struct acpiphp_bridge *bridge) int acpiphp_check_bridge(struct acpiphp_bridge *bridge)
{ {
struct acpiphp_slot *slot; struct acpiphp_slot *slot;
unsigned int sta;
int retval = 0; int retval = 0;
int enabled, disabled; int enabled, disabled;
enabled = disabled = 0; enabled = disabled = 0;
for (slot = bridge->slots; slot; slot = slot->next) { for (slot = bridge->slots; slot; slot = slot->next) {
sta = get_slot_status(slot); unsigned int status = get_slot_status(slot);
if (slot->flags & SLOT_ENABLED) { if (slot->flags & SLOT_ENABLED) {
/* if enabled but not present, disable */ if (status == ACPI_STA_ALL)
if (sta != ACPI_STA_ALL) { continue;
retval = acpiphp_disable_slot(slot); retval = acpiphp_disable_slot(slot);
if (retval) { if (retval) {
err("Error occurred in enabling\n"); err("Error occurred in disabling\n");
up(&slot->crit_sect); goto err_exit;
goto err_exit;
}
disabled++;
} }
disabled++;
} else { } else {
/* if disabled but present, enable */ if (status != ACPI_STA_ALL)
if (sta == ACPI_STA_ALL) { continue;
retval = acpiphp_enable_slot(slot); retval = acpiphp_enable_slot(slot);
if (retval) { if (retval) {
err("Error occurred in enabling\n"); err("Error occurred in enabling\n");
up(&slot->crit_sect); goto err_exit;
goto err_exit;
}
enabled++;
} }
enabled++;
} }
} }
......
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