Commit f7fdea0b authored by Rolf Eike Beer's avatar Rolf Eike Beer Committed by Deepak Saxena

[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.
parent 77ddc744
......@@ -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 @@ static int enable_slot (struct hotplug_slot *hotplug_slot)
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 @@ static int disable_slot (struct hotplug_slot *hotplug_slot)
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 @@ static int hardware_test (struct hotplug_slot *hotplug_slot, u32 value)
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 @@ static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value)
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 @@ static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value)
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 @@ static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value)
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 @@ static int get_address (struct hotplug_slot *hotplug_slot, u32 *value)
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 @@ static int get_max_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_sp
{
struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
if (slot == NULL)
return -ENODEV;
*value = PCI_SPEED_UNKNOWN;
return 0;
......@@ -365,9 +337,6 @@ static int get_cur_bus_speed (struct hotplug_slot *hotplug_slot, enum pci_bus_sp
{
struct slot *slot = get_slot(hotplug_slot, __FUNCTION__);
if (slot == NULL)
return -ENODEV;
*value = PCI_SPEED_UNKNOWN;
return 0;
......@@ -411,9 +380,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);
kfree(slot->hotplug_slot->info);
......
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