Skip to content

Commit cfbd83d

Browse files
kwilczynskibjorn-helgaas
authored andcommitted
PCI: shpchp: Make shpchp_unconfigure_device() void
shpchp_unconfigure_device() always returned 0, so there's no reason for a return value. In addition, remove_board() checked the return value for possible error which is unnecessary. Convert shpchp_unconfigure_device() to a void function and remove the return value check. This addresses the following Coccinelle warning: drivers/pci/hotplug/shpchp_pci.c:66:5-7: Unneeded variable: "rc". Return "0" on line 86 Link: https://lore.kernel.org/r/20200521190457.1066600-1-kw@linux.com Signed-off-by: Krzysztof Wilczynski <kw@linux.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
1 parent adc9fbc commit cfbd83d

3 files changed

Lines changed: 3 additions & 7 deletions

File tree

‎drivers/pci/hotplug/shpchp.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ u8 shpchp_handle_switch_change(u8 hp_slot, struct controller *ctrl);
164164
u8 shpchp_handle_presence_change(u8 hp_slot, struct controller *ctrl);
165165
u8 shpchp_handle_power_fault(u8 hp_slot, struct controller *ctrl);
166166
int shpchp_configure_device(struct slot *p_slot);
167-
int shpchp_unconfigure_device(struct slot *p_slot);
167+
void shpchp_unconfigure_device(struct slot *p_slot);
168168
void cleanup_slots(struct controller *ctrl);
169169
void shpchp_queue_pushbutton_work(struct work_struct *work);
170170
int shpc_init(struct controller *ctrl, struct pci_dev *pdev);

‎drivers/pci/hotplug/shpchp_ctrl.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,7 @@ static int remove_board(struct slot *p_slot)
341341
u8 hp_slot;
342342
int rc;
343343

344-
if (shpchp_unconfigure_device(p_slot))
345-
return(1);
344+
shpchp_unconfigure_device(p_slot);
346345

347346
hp_slot = p_slot->device - ctrl->slot_device_offset;
348347
p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);

‎drivers/pci/hotplug/shpchp_pci.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,8 @@ int shpchp_configure_device(struct slot *p_slot)
6161
return ret;
6262
}
6363

64-
int shpchp_unconfigure_device(struct slot *p_slot)
64+
void shpchp_unconfigure_device(struct slot *p_slot)
6565
{
66-
int rc = 0;
6766
struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate;
6867
struct pci_dev *dev, *temp;
6968
struct controller *ctrl = p_slot->ctrl;
@@ -83,6 +82,4 @@ int shpchp_unconfigure_device(struct slot *p_slot)
8382
}
8483

8584
pci_unlock_rescan_remove();
86-
return rc;
8785
}
88-

0 commit comments

Comments
 (0)