Skip to contentSkip to conversation

cpqhp_pushbutton_thread(): remove a pointless if() check

PATCH New Adrian Bunk 1 participant 1 message Aug 14, 2007 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpqhp_pushbutton_thread(): remove a pointless if() check

The Coverity checker spotted that we'd have already oops'ed if "ctrl" was NULL.

Additionally, "func" had just been checked for not being NULL.

---

drivers/pci/hotplug/cpqphp_ctrl.c renamed from drivers/pci/hotplug/cpqphp_ctrl.c.old +7 -9
@@ -1951,30 +1951,28 @@ void cpqhp_pushbutton_thread(unsigned lo
 	if (is_slot_enabled(ctrl, hp_slot)) {
 		p_slot->state = POWEROFF_STATE;
 		/* power Down board */
 		func = cpqhp_slot_find(p_slot->bus, p_slot->device, 0);
 		dbg("In power_down_board, func = %p, ctrl = %p\n", func, ctrl);
 		if (!func) {
 			dbg("Error! func NULL in %s\n", __FUNCTION__);
 			return ;
 		}
 
-		if (func != NULL && ctrl != NULL) {
-			if (cpqhp_process_SS(ctrl, func) != 0) {
-				amber_LED_on (ctrl, hp_slot);
-				green_LED_on (ctrl, hp_slot);
-				
-				set_SOGO(ctrl);
+		if (cpqhp_process_SS(ctrl, func) != 0) {
+			amber_LED_on (ctrl, hp_slot);
+			green_LED_on (ctrl, hp_slot);
+			
+			set_SOGO(ctrl);
 
-				/* Wait for SOBS to be unset */
-				wait_for_ctrl_irq (ctrl);
-			}
+			/* Wait for SOBS to be unset */
+			wait_for_ctrl_irq (ctrl);
 		}
 
 		p_slot->state = STATIC_STATE;
 	} else {
 		p_slot->state = POWERON_STATE;
 		/* slot is off */
 
 		func = cpqhp_slot_find(p_slot->bus, p_slot->device, 0);
 		dbg("In add_board, func = %p, ctrl = %p\n", func, ctrl);
 		if (!func) {