* [PATCH] PCI: shpchp: Remove unused assignment to variable rc
@ 2020-09-23 2:52 Krzysztof Wilczyński
2020-09-28 22:28 ` Bjorn Helgaas
0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Wilczyński @ 2020-09-23 2:52 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: linux-pci
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")
Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
---
drivers/pci/hotplug/shpchp_ctrl.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
index 65502e3f7b4f..6a6705e0cf17 100644
--- a/drivers/pci/hotplug/shpchp_ctrl.c
+++ b/drivers/pci/hotplug/shpchp_ctrl.c
@@ -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;
}
--
2.28.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] PCI: shpchp: Remove unused assignment to variable rc
2020-09-23 2:52 [PATCH] PCI: shpchp: Remove unused assignment to variable rc Krzysztof Wilczyński
@ 2020-09-28 22:28 ` Bjorn Helgaas
0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2020-09-28 22:28 UTC (permalink / raw)
To: Krzysztof Wilczyński; +Cc: Bjorn Helgaas, linux-pci
On Wed, Sep 23, 2020 at 02:52:25AM +0000, Krzysztof Wilczyński wrote:
> 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")
> Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
Applied to pci/hotplug for v5.10, thanks!
> ---
> drivers/pci/hotplug/shpchp_ctrl.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
> index 65502e3f7b4f..6a6705e0cf17 100644
> --- a/drivers/pci/hotplug/shpchp_ctrl.c
> +++ b/drivers/pci/hotplug/shpchp_ctrl.c
> @@ -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;
> }
> --
> 2.28.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-28 23:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-23 2:52 [PATCH] PCI: shpchp: Remove unused assignment to variable rc Krzysztof Wilczyński
2020-09-28 22:28 ` Bjorn Helgaas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).