diff options
| author | Adrian Bunk <bunk@stusta.de> | 2006-02-26 22:16:51 +0100 | 
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-03-23 14:35:16 -0800 | 
| commit | 1305e9184a3de84f78dca102b293d21007bb6c49 (patch) | |
| tree | 4cefbc44ce9ac3e8563a64fd76590a4f24cf389d | |
| parent | 0cccd0c20677e8a9da40018632f1b6c487ba2bd5 (diff) | |
| download | olio-linux-3.10-1305e9184a3de84f78dca102b293d21007bb6c49.tar.xz olio-linux-3.10-1305e9184a3de84f78dca102b293d21007bb6c49.zip  | |
[PATCH] PCI: cpqphp_ctrl.c: board_replaced(): remove dead code
The Coverity checker correctly noted, that in function board_replaced in
drivers/pci/hotplug/cpqphp_ctrl.c, the variable src always has the
value 8, and therefore much code after the
...
                        if (rc || src) {
...
                                if (rc)
                                        return rc;
                                else
                                        return 1;
                        }
...
can never be called.
This patch removes the unreachable code in this function fixing kernel
Bugzilla #6073.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
| -rw-r--r-- | drivers/pci/hotplug/cpqphp_ctrl.c | 76 | 
1 files changed, 14 insertions, 62 deletions
diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c index 72eb8e2d206..55d2dc7e39c 100644 --- a/drivers/pci/hotplug/cpqphp_ctrl.c +++ b/drivers/pci/hotplug/cpqphp_ctrl.c @@ -1282,9 +1282,7 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl)  	u8 hp_slot;  	u8 temp_byte;  	u8 adapter_speed; -	u32 index;  	u32 rc = 0; -	u32 src = 8;  	hp_slot = func->device - ctrl->slot_device_offset; @@ -1368,68 +1366,17 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl)  			rc = cpqhp_configure_board(ctrl, func); -			if (rc || src) { -				/* If configuration fails, turn it off -				 * Get slot won't work for devices behind -				 * bridges, but in this case it will always be -				 * called for the "base" bus/dev/func of an -				 * adapter. */ - -				mutex_lock(&ctrl->crit_sect); - -				amber_LED_on (ctrl, hp_slot); -				green_LED_off (ctrl, hp_slot); -				slot_disable (ctrl, hp_slot); - -				set_SOGO(ctrl); - -				/* Wait for SOBS to be unset */ -				wait_for_ctrl_irq (ctrl); - -				mutex_unlock(&ctrl->crit_sect); - -				if (rc) -					return rc; -				else -					return 1; -			} - -			func->status = 0; -			func->switch_save = 0x10; - -			index = 1; -			while (((func = cpqhp_slot_find(func->bus, func->device, index)) != NULL) && !rc) { -				rc |= cpqhp_configure_board(ctrl, func); -				index++; -			} - -			if (rc) { -				/* If configuration fails, turn it off -				 * Get slot won't work for devices behind -				 * bridges, but in this case it will always be -				 * called for the "base" bus/dev/func of an -				 * adapter. */ - -				mutex_lock(&ctrl->crit_sect); - -				amber_LED_on (ctrl, hp_slot); -				green_LED_off (ctrl, hp_slot); -				slot_disable (ctrl, hp_slot); - -				set_SOGO(ctrl); - -				/* Wait for SOBS to be unset */ -				wait_for_ctrl_irq (ctrl); - -				mutex_unlock(&ctrl->crit_sect); - -				return rc; -			} -			/* Done configuring so turn LED on full time */ +			/* If configuration fails, turn it off +			 * Get slot won't work for devices behind +			 * bridges, but in this case it will always be +			 * called for the "base" bus/dev/func of an +			 * adapter. */  			mutex_lock(&ctrl->crit_sect); -			green_LED_on (ctrl, hp_slot); +			amber_LED_on (ctrl, hp_slot); +			green_LED_off (ctrl, hp_slot); +			slot_disable (ctrl, hp_slot);  			set_SOGO(ctrl); @@ -1437,7 +1384,12 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl)  			wait_for_ctrl_irq (ctrl);  			mutex_unlock(&ctrl->crit_sect); -			rc = 0; + +			if (rc) +				return rc; +			else +				return 1; +  		} else {  			/* Something is wrong  |