ChangeSet 1.1587.12.84, 2004/05/11 14:43:25-07:00, eike-hotplug@sf-tec.de [PATCH] CompactPCI: remove useless NULL checks If the "struct hotplug_slot *" parameter is ever NULL then something bogus is going on, we should not hide this bug by catching it. Also the name used in debug messages is fixed. Eike drivers/pci/hotplug/cpci_hotplug_core.c | 26 -------------------------- 1 files changed, 26 deletions(-) diff -Nru a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c --- a/drivers/pci/hotplug/cpci_hotplug_core.c Mon May 17 16:57:24 2004 +++ b/drivers/pci/hotplug/cpci_hotplug_core.c Mon May 17 16:57:24 2004 @@ -40,11 +40,7 @@ #define DRIVER_AUTHOR "Scott Murray " #define DRIVER_DESC "CompactPCI Hot Plug Core" -#if !defined(CONFIG_HOTPLUG_CPCI_MODULE) #define MY_NAME "cpci_hotplug" -#else -#define MY_NAME THIS_MODULE->name -#endif #define dbg(format, arg...) \ do { \ @@ -79,7 +75,6 @@ .enable_slot = enable_slot, .disable_slot = disable_slot, .set_attention_status = set_attention_status, - .hardware_test = NULL, .get_power_status = get_power_status, .get_attention_status = get_attention_status, .get_latch_status = get_latch_status, @@ -122,8 +117,6 @@ { struct hotplug_slot_info info; - if(!(hotplug_slot && hotplug_slot->info)) - return -EINVAL; memcpy(&info, hotplug_slot->info, sizeof(struct hotplug_slot_info)); info.latch_status = value; return pci_hp_change_slot_info(hotplug_slot, &info); @@ -134,8 +127,6 @@ { struct hotplug_slot_info info; - if(!(hotplug_slot && hotplug_slot->info)) - return -EINVAL; memcpy(&info, hotplug_slot->info, sizeof(struct hotplug_slot_info)); info.adapter_status = value; return pci_hp_change_slot_info(hotplug_slot, &info); @@ -147,9 +138,6 @@ struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); int retval = 0; - if(slot == NULL) - return -ENODEV; - dbg("%s - physical_slot = %s", __FUNCTION__, hotplug_slot->name); if(controller->ops->set_power) { @@ -165,9 +153,6 @@ struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); int retval = 0; - if(slot == NULL) - return -ENODEV; - dbg("%s - physical_slot = %s", __FUNCTION__, hotplug_slot->name); /* Unconfigure device */ @@ -218,8 +203,6 @@ { struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); - if(slot == NULL) - return -ENODEV; *value = cpci_get_power_status(slot); return 0; } @@ -229,8 +212,6 @@ { struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); - if(slot == NULL) - return -ENODEV; *value = cpci_get_attention_status(slot); return 0; } @@ -244,8 +225,6 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 * value) { - if(hotplug_slot == NULL || hotplug_slot->info == NULL) - return -ENODEV; *value = hotplug_slot->info->latch_status; return 0; } @@ -253,8 +232,6 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 * value) { - if(hotplug_slot == NULL || hotplug_slot->info == NULL) - return -ENODEV; *value = hotplug_slot->info->adapter_status; return 0; } @@ -262,9 +239,6 @@ static void release_slot(struct hotplug_slot *hotplug_slot) { struct slot *slot = get_slot(hotplug_slot, __FUNCTION__); - - if(slot == NULL) - return; kfree(slot->hotplug_slot->info); kfree(slot->hotplug_slot->name);