* [PATCH] PCI: shpchp: Remove surplus variable and ineffectual error check
@ 2020-05-21 19:04 Krzysztof Wilczynski
2020-05-21 20:20 ` Bjorn Helgaas
0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Wilczynski @ 2020-05-21 19:04 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: linux-pci
Function remove_board() calls shpchp_unconfigure_device() and checks its
return code for a possible error which is unnecessary as
shpchp_unconfigure_device() always returns 0.
Also, remove surplus variable that has not been used for anything. This
will also address the following Coccinelle warning:
drivers/pci/hotplug/shpchp_pci.c:66:5-7: Unneeded variable: "rc".
Return "0" on line 86
Signed-off-by: Krzysztof Wilczynski <kw@linux.com>
---
drivers/pci/hotplug/shpchp.h | 2 +-
drivers/pci/hotplug/shpchp_ctrl.c | 3 +--
drivers/pci/hotplug/shpchp_pci.c | 5 +----
3 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h
index f7f13ee5d06e..6e85885b554c 100644
--- a/drivers/pci/hotplug/shpchp.h
+++ b/drivers/pci/hotplug/shpchp.h
@@ -164,7 +164,7 @@ u8 shpchp_handle_switch_change(u8 hp_slot, struct controller *ctrl);
u8 shpchp_handle_presence_change(u8 hp_slot, struct controller *ctrl);
u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl);
int shpchp_configure_device(struct slot *p_slot);
-int shpchp_unconfigure_device(struct slot *p_slot);
+void shpchp_unconfigure_device(struct slot *p_slot);
void cleanup_slots(struct controller *ctrl);
void shpchp_queue_pushbutton_work(struct work_struct *work);
int shpc_init(struct controller *ctrl, struct pci_dev *pdev);
diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
index 078003dcde5b..afdc52d1cae7 100644
--- a/drivers/pci/hotplug/shpchp_ctrl.c
+++ b/drivers/pci/hotplug/shpchp_ctrl.c
@@ -341,8 +341,7 @@ static int remove_board(struct slot *p_slot)
u8 hp_slot;
int rc;
- if (shpchp_unconfigure_device(p_slot))
- return(1);
+ shpchp_unconfigure_device(p_slot);
hp_slot = p_slot->device - ctrl->slot_device_offset;
p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
diff --git a/drivers/pci/hotplug/shpchp_pci.c b/drivers/pci/hotplug/shpchp_pci.c
index 115701301487..36db0c3c4ea6 100644
--- a/drivers/pci/hotplug/shpchp_pci.c
+++ b/drivers/pci/hotplug/shpchp_pci.c
@@ -61,9 +61,8 @@ int shpchp_configure_device(struct slot *p_slot)
return ret;
}
-int shpchp_unconfigure_device(struct slot *p_slot)
+void shpchp_unconfigure_device(struct slot *p_slot)
{
- int rc = 0;
struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate;
struct pci_dev *dev, *temp;
struct controller *ctrl = p_slot->ctrl;
@@ -83,6 +82,4 @@ int shpchp_unconfigure_device(struct slot *p_slot)
}
pci_unlock_rescan_remove();
- return rc;
}
-
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] PCI: shpchp: Remove surplus variable and ineffectual error check
2020-05-21 19:04 [PATCH] PCI: shpchp: Remove surplus variable and ineffectual error check Krzysztof Wilczynski
@ 2020-05-21 20:20 ` Bjorn Helgaas
0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2020-05-21 20:20 UTC (permalink / raw)
To: Krzysztof Wilczynski; +Cc: Bjorn Helgaas, linux-pci
On Thu, May 21, 2020 at 07:04:57PM +0000, Krzysztof Wilczynski wrote:
> Function remove_board() calls shpchp_unconfigure_device() and checks its
> return code for a possible error which is unnecessary as
> shpchp_unconfigure_device() always returns 0.
>
> Also, remove surplus variable that has not been used for anything. This
> will also address the following Coccinelle warning:
>
> drivers/pci/hotplug/shpchp_pci.c:66:5-7: Unneeded variable: "rc".
> Return "0" on line 86
>
> Signed-off-by: Krzysztof Wilczynski <kw@linux.com>
Applied to pci/hotplug for v5.8, thanks!
> ---
> drivers/pci/hotplug/shpchp.h | 2 +-
> drivers/pci/hotplug/shpchp_ctrl.c | 3 +--
> drivers/pci/hotplug/shpchp_pci.c | 5 +----
> 3 files changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h
> index f7f13ee5d06e..6e85885b554c 100644
> --- a/drivers/pci/hotplug/shpchp.h
> +++ b/drivers/pci/hotplug/shpchp.h
> @@ -164,7 +164,7 @@ u8 shpchp_handle_switch_change(u8 hp_slot, struct controller *ctrl);
> u8 shpchp_handle_presence_change(u8 hp_slot, struct controller *ctrl);
> u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl);
> int shpchp_configure_device(struct slot *p_slot);
> -int shpchp_unconfigure_device(struct slot *p_slot);
> +void shpchp_unconfigure_device(struct slot *p_slot);
> void cleanup_slots(struct controller *ctrl);
> void shpchp_queue_pushbutton_work(struct work_struct *work);
> int shpc_init(struct controller *ctrl, struct pci_dev *pdev);
> diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
> index 078003dcde5b..afdc52d1cae7 100644
> --- a/drivers/pci/hotplug/shpchp_ctrl.c
> +++ b/drivers/pci/hotplug/shpchp_ctrl.c
> @@ -341,8 +341,7 @@ static int remove_board(struct slot *p_slot)
> u8 hp_slot;
> int rc;
>
> - if (shpchp_unconfigure_device(p_slot))
> - return(1);
> + shpchp_unconfigure_device(p_slot);
>
> hp_slot = p_slot->device - ctrl->slot_device_offset;
> p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
> diff --git a/drivers/pci/hotplug/shpchp_pci.c b/drivers/pci/hotplug/shpchp_pci.c
> index 115701301487..36db0c3c4ea6 100644
> --- a/drivers/pci/hotplug/shpchp_pci.c
> +++ b/drivers/pci/hotplug/shpchp_pci.c
> @@ -61,9 +61,8 @@ int shpchp_configure_device(struct slot *p_slot)
> return ret;
> }
>
> -int shpchp_unconfigure_device(struct slot *p_slot)
> +void shpchp_unconfigure_device(struct slot *p_slot)
> {
> - int rc = 0;
> struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate;
> struct pci_dev *dev, *temp;
> struct controller *ctrl = p_slot->ctrl;
> @@ -83,6 +82,4 @@ int shpchp_unconfigure_device(struct slot *p_slot)
> }
>
> pci_unlock_rescan_remove();
> - return rc;
> }
> -
> --
> 2.26.2
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-21 20:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-21 19:04 [PATCH] PCI: shpchp: Remove surplus variable and ineffectual error check Krzysztof Wilczynski
2020-05-21 20:20 ` Bjorn Helgaas
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.