ChangeSet 1.1587.12.6, 2004/04/29 14:23:01-07:00, eike-hotplug@sf-tec.de [PATCH] PCI Hotplug: Clean up acpiphp_core.c: null checks If the "struct hotplug_struct *" parameter to any function in hotplug_slots_ops is ever NULL something bogus is going on. In this case we should just oops and not hide the bug. This also fixes the driver name used in debug messages. drivers/pci/hotplug/acpiphp_core.c | 36 +----------------------------------- 1 files changed, 1 insertion(+), 35 deletions(-) diff -Nru a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c --- a/drivers/pci/hotplug/acpiphp_core.c Mon May 17 17:08:24 2004 +++ b/drivers/pci/hotplug/acpiphp_core.c Mon May 17 17:08:24 2004 @@ -43,11 +43,7 @@ static LIST_HEAD(slot_list); -#if !defined(CONFIG_HOTPLUG_PCI_ACPI_MODULE) - #define MY_NAME "acpiphp" -#else - #define MY_NAME THIS_MODULE->name -#endif +#define MY_NAME "acpiphp" static int debug; int acpiphp_debug; @@ -140,9 +136,6 @@ struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); int retval = 0; - if (slot == NULL) - return -ENODEV; - dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); /* enable the specified slot */ @@ -164,9 +157,6 @@ struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); int retval = 0; - if (slot == NULL) - return -ENODEV; - dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); /* disable the specified slot */ @@ -218,9 +208,6 @@ struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); int retval = 0; - if (slot == NULL) - return -ENODEV; - dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); err("No hardware tests are defined for this driver\n"); @@ -244,9 +231,6 @@ struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); int retval = 0; - if (slot == NULL) - return -ENODEV; - dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); *value = acpiphp_get_power_status(slot->acpi_slot); @@ -288,9 +272,6 @@ struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); int retval = 0; - if (slot == NULL) - return -ENODEV; - dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); *value = acpiphp_get_latch_status(slot->acpi_slot); @@ -313,9 +294,6 @@ struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); int retval = 0; - if (slot == NULL) - return -ENODEV; - dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); *value = acpiphp_get_adapter_status(slot->acpi_slot); @@ -335,9 +313,6 @@ struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); int retval = 0; - if (slot == NULL) - return -ENODEV; - dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); *value = acpiphp_get_address(slot->acpi_slot); @@ -351,9 +326,6 @@ { struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); - if (slot == NULL) - return -ENODEV; - *value = PCI_SPEED_UNKNOWN; return 0; @@ -365,9 +337,6 @@ { struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); - if (slot == NULL) - return -ENODEV; - *value = PCI_SPEED_UNKNOWN; return 0; @@ -410,9 +379,6 @@ static void release_slot(struct hotplug_slot *hotplug_slot) { struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); - - if (slot == NULL) - return; dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);