PCI: shpchp: Remove unused assignment to variable rc
PATCH 1/1 PCI: shpchp: Remove unused assignment to variable rc
The value of the constant POWER_FAILURE assigned to the variable rc after the power fault check is never used for anything within the body of the board_added() function and it is also overridden later following jump to the err_exit label with the return value from the slot_disable() callback.
Since the value of rc is never used in any meaningful way the assignment can be removed.
I believe the assignment of constant POWER_FAILURE to the rc variable was initially taken from the file drivers/pci/hotplug/cpqphp_ctrl.c and then used in the file pci/hotplug/shpchp_ctrl.c (the code base is very similar) around the time of the Kernel version 2.6.4-rc1 when the support for the Standard Hot Plug was first added, sadly the Git history only goes as far as to commit 1da177e4c3f4 ("Linux-2.6.12-rc2").
Related:
https://elixir.bootlin.com/linux/v2.6.4-rc1/source/drivers/pci/hotplug/shpchp_ctrl.c
https://elixir.bootlin.com/linux/v2.6.4-rc1/source/drivers/pci/hotplug/cpqphp_ctrl.c
Addresses-Coverity-ID: 1226899 ("Unused value")
--- drivers/pci/hotplug/shpchp_ctrl.c | 1 - 1 file changed, 1 deletion(-)
drivers/pci/hotplug/shpchp_ctrl.c +0 -1
@@ -299,7 +299,6 @@ static int board_added(struct slot *p_slot)if (p_slot->status ==0xFF ) {/* power fault occurred, but it was benign */ ctrl_dbg (ctrl,"%s: Power fault\n" , __func__); - rc =POWER_FAILURE ; p_slot->status =0 ; goto err_exit; }
Signature · 1 line
2.28.0
Bjorn Helgaas
AppliedQuoted 16 lines · Krzysztof Wilczyński
The value of the constant
POWER_FAILUREassigned to the variable rc after the power fault check is never used for anything within the body of theboard_added()function and it is also overridden later following jump to theerr_exitlabel with the return value from theslot_disable()callback.Since the value of rc is never used in any meaningful way the assignment can be removed.
I believe the assignment of constant
POWER_FAILUREto the rc variable was initially taken from the filedrivers/pci/hotplug/cpqphp_ctrl.cand then used in the filepci/hotplug/shpchp_ctrl.c(the code base is very similar) around the time of the Kernel version 2.6.4-rc1 when the support for the Standard Hot Plug was first added, sadly the Git history only goes as far as to commit1da177e4c3f4("Linux-2.6.12-rc2").
Quoted 6 lines
Related:
https://elixir.bootlin.com/linux/v2.6.4-rc1/source/drivers/pci/hotplug/shpchp_ctrl.c
https://elixir.bootlin.com/linux/v2.6.4-rc1/source/drivers/pci/hotplug/cpqphp_ctrl.cAddresses-Coverity-ID: 1226899 ("Unused value")
Signed-off-by Krzysztof Wilczyński <[email protected]>
Applied to pci/hotplug for v5.10, thanks!
Quoted 19 lines
--- drivers/pci/hotplug/shpchp_ctrl.c | 1 - 1 file changed, 1 deletion(-)drivers/pci/hotplug/shpchp_ctrl.c +0
-1@@ -299,7 +299,6 @@ static int board_added(struct slot *p_slot)if (p_slot->status ==0xFF ) {/* power fault occurred, but it was benign */ ctrl_dbg (ctrl,"%s: Power fault\n" , __func__); - rc =POWER_FAILURE ; p_slot->status =0 ; goto err_exit; }Signature · 1 line
2.28.0