Skip to content

Commit af8b8b6

Browse files
committed
PCI: cpqphp: Remove unused assignments
Remove variables and assignments that are never used. Found by Krzysztof using cppcheck, e.g.: $ cppcheck --enable=all --force unreadVariable drivers/pci/hotplug/cpqphp_core.c:1257 Variable 'rc' is assigned a value that is never used. Reported-by: Krzysztof Wilczyński <kw@linux.com> Link: https://lore.kernel.org/r/20220313192933.434746-5-helgaas@kernel.org Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
1 parent 6f10255 commit af8b8b6

3 files changed

Lines changed: 7 additions & 19 deletions

File tree

drivers/pci/hotplug/cpqphp_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,7 @@ static void __exit unload_cpqphpd(void)
12541254
struct pci_resource *res;
12551255
struct pci_resource *tres;
12561256

1257-
rc = compaq_nvram_store(cpqhp_rom_start);
1257+
compaq_nvram_store(cpqhp_rom_start);
12581258

12591259
ctrl = cpqhp_ctrl_list;
12601260

drivers/pci/hotplug/cpqphp_ctrl.c

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,6 @@ irqreturn_t cpqhp_ctrl_intr(int IRQ, void *data)
881881
u8 reset;
882882
u16 misc;
883883
u32 Diff;
884-
u32 temp_dword;
885884

886885

887886
misc = readw(ctrl->hpc_reg + MISC);
@@ -917,7 +916,7 @@ irqreturn_t cpqhp_ctrl_intr(int IRQ, void *data)
917916
writel(Diff, ctrl->hpc_reg + INT_INPUT_CLEAR);
918917

919918
/* Read it back to clear any posted writes */
920-
temp_dword = readl(ctrl->hpc_reg + INT_INPUT_CLEAR);
919+
readl(ctrl->hpc_reg + INT_INPUT_CLEAR);
921920

922921
if (!Diff)
923922
/* Clear all interrupts */
@@ -1412,7 +1411,6 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl)
14121411
u32 rc = 0;
14131412
struct pci_func *new_slot = NULL;
14141413
struct pci_bus *bus = ctrl->pci_bus;
1415-
struct slot *p_slot;
14161414
struct resource_lists res_lists;
14171415

14181416
hp_slot = func->device - ctrl->slot_device_offset;
@@ -1459,7 +1457,7 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl)
14591457
if (rc)
14601458
return rc;
14611459

1462-
p_slot = cpqhp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
1460+
cpqhp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);
14631461

14641462
/* turn on board and blink green LED */
14651463

@@ -1614,7 +1612,6 @@ static u32 remove_board(struct pci_func *func, u32 replace_flag, struct controll
16141612
u8 device;
16151613
u8 hp_slot;
16161614
u8 temp_byte;
1617-
u32 rc;
16181615
struct resource_lists res_lists;
16191616
struct pci_func *temp_func;
16201617

@@ -1629,7 +1626,7 @@ static u32 remove_board(struct pci_func *func, u32 replace_flag, struct controll
16291626
/* When we get here, it is safe to change base address registers.
16301627
* We will attempt to save the base address register lengths */
16311628
if (replace_flag || !ctrl->add_support)
1632-
rc = cpqhp_save_base_addr_length(ctrl, func);
1629+
cpqhp_save_base_addr_length(ctrl, func);
16331630
else if (!func->bus_head && !func->mem_head &&
16341631
!func->p_mem_head && !func->io_head) {
16351632
/* Here we check to see if we've saved any of the board's
@@ -1647,7 +1644,7 @@ static u32 remove_board(struct pci_func *func, u32 replace_flag, struct controll
16471644
}
16481645

16491646
if (!skip)
1650-
rc = cpqhp_save_used_resources(ctrl, func);
1647+
cpqhp_save_used_resources(ctrl, func);
16511648
}
16521649
/* Change status to shutdown */
16531650
if (func->is_a_board)
@@ -1767,7 +1764,7 @@ void cpqhp_event_stop_thread(void)
17671764

17681765
static void interrupt_event_handler(struct controller *ctrl)
17691766
{
1770-
int loop = 0;
1767+
int loop;
17711768
int change = 1;
17721769
struct pci_func *func;
17731770
u8 hp_slot;
@@ -1885,16 +1882,13 @@ static void interrupt_event_handler(struct controller *ctrl)
18851882
void cpqhp_pushbutton_thread(struct timer_list *t)
18861883
{
18871884
u8 hp_slot;
1888-
u8 device;
18891885
struct pci_func *func;
18901886
struct slot *p_slot = from_timer(p_slot, t, task_event);
18911887
struct controller *ctrl = (struct controller *) p_slot->ctrl;
18921888

18931889
pushbutton_pending = NULL;
18941890
hp_slot = p_slot->hp_slot;
18951891

1896-
device = p_slot->device;
1897-
18981892
if (is_slot_enabled(ctrl, hp_slot)) {
18991893
p_slot->state = POWEROFF_STATE;
19001894
/* power Down board */
@@ -1951,15 +1945,12 @@ int cpqhp_process_SI(struct controller *ctrl, struct pci_func *func)
19511945
u32 tempdword;
19521946
int rc;
19531947
struct slot *p_slot;
1954-
int physical_slot = 0;
19551948

19561949
tempdword = 0;
19571950

19581951
device = func->device;
19591952
hp_slot = device - ctrl->slot_device_offset;
19601953
p_slot = cpqhp_find_slot(ctrl, device);
1961-
if (p_slot)
1962-
physical_slot = p_slot->number;
19631954

19641955
/* Check to see if the interlock is closed */
19651956
tempdword = readl(ctrl->hpc_reg + INT_INPUT_CLEAR);
@@ -2043,13 +2034,10 @@ int cpqhp_process_SS(struct controller *ctrl, struct pci_func *func)
20432034
unsigned int devfn;
20442035
struct slot *p_slot;
20452036
struct pci_bus *pci_bus = ctrl->pci_bus;
2046-
int physical_slot = 0;
20472037

20482038
device = func->device;
20492039
func = cpqhp_slot_find(ctrl->bus, device, index++);
20502040
p_slot = cpqhp_find_slot(ctrl, device);
2051-
if (p_slot)
2052-
physical_slot = p_slot->number;
20532041

20542042
/* Make sure there are no video controllers here */
20552043
while (func && !rc) {

drivers/pci/hotplug/cpqphp_pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ int cpqhp_save_slot_config(struct controller *ctrl, struct pci_func *new_slot)
473473
int sub_bus;
474474
int max_functions;
475475
int function = 0;
476-
int cloop = 0;
476+
int cloop;
477477
int stop_it;
478478

479479
ID = 0xFFFFFFFF;

0 commit comments

Comments
 (0)