Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+7 -19
+1 -1
drivers/pci/hotplug/cpqphp_core.c
··· 1254 1254 struct pci_resource *res; 1255 1255 struct pci_resource *tres; 1256 1256 1257 - rc = compaq_nvram_store(cpqhp_rom_start); 1257 + compaq_nvram_store(cpqhp_rom_start); 1258 1258 1259 1259 ctrl = cpqhp_ctrl_list; 1260 1260
+5 -17
drivers/pci/hotplug/cpqphp_ctrl.c
··· 881 881 u8 reset; 882 882 u16 misc; 883 883 u32 Diff; 884 - u32 temp_dword; 885 884 886 885 887 886 misc = readw(ctrl->hpc_reg + MISC); ··· 916 917 writel(Diff, ctrl->hpc_reg + INT_INPUT_CLEAR); 917 918 918 919 /* Read it back to clear any posted writes */ 919 - temp_dword = readl(ctrl->hpc_reg + INT_INPUT_CLEAR); 920 + readl(ctrl->hpc_reg + INT_INPUT_CLEAR); 920 921 921 922 if (!Diff) 922 923 /* Clear all interrupts */ ··· 1411 1412 u32 rc = 0; 1412 1413 struct pci_func *new_slot = NULL; 1413 1414 struct pci_bus *bus = ctrl->pci_bus; 1414 - struct slot *p_slot; 1415 1415 struct resource_lists res_lists; 1416 1416 1417 1417 hp_slot = func->device - ctrl->slot_device_offset; ··· 1457 1459 if (rc) 1458 1460 return rc; 1459 1461 1460 - p_slot = cpqhp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 1462 + cpqhp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 1461 1463 1462 1464 /* turn on board and blink green LED */ 1463 1465 ··· 1612 1614 u8 device; 1613 1615 u8 hp_slot; 1614 1616 u8 temp_byte; 1615 - u32 rc; 1616 1617 struct resource_lists res_lists; 1617 1618 struct pci_func *temp_func; 1618 1619 ··· 1626 1629 /* When we get here, it is safe to change base address registers. 1627 1630 * We will attempt to save the base address register lengths */ 1628 1631 if (replace_flag || !ctrl->add_support) 1629 - rc = cpqhp_save_base_addr_length(ctrl, func); 1632 + cpqhp_save_base_addr_length(ctrl, func); 1630 1633 else if (!func->bus_head && !func->mem_head && 1631 1634 !func->p_mem_head && !func->io_head) { 1632 1635 /* Here we check to see if we've saved any of the board's ··· 1644 1647 } 1645 1648 1646 1649 if (!skip) 1647 - rc = cpqhp_save_used_resources(ctrl, func); 1650 + cpqhp_save_used_resources(ctrl, func); 1648 1651 } 1649 1652 /* Change status to shutdown */ 1650 1653 if (func->is_a_board) ··· 1764 1767 1765 1768 static void interrupt_event_handler(struct controller *ctrl) 1766 1769 { 1767 - int loop = 0; 1770 + int loop; 1768 1771 int change = 1; 1769 1772 struct pci_func *func; 1770 1773 u8 hp_slot; ··· 1882 1885 void cpqhp_pushbutton_thread(struct timer_list *t) 1883 1886 { 1884 1887 u8 hp_slot; 1885 - u8 device; 1886 1888 struct pci_func *func; 1887 1889 struct slot *p_slot = from_timer(p_slot, t, task_event); 1888 1890 struct controller *ctrl = (struct controller *) p_slot->ctrl; 1889 1891 1890 1892 pushbutton_pending = NULL; 1891 1893 hp_slot = p_slot->hp_slot; 1892 - 1893 - device = p_slot->device; 1894 1894 1895 1895 if (is_slot_enabled(ctrl, hp_slot)) { 1896 1896 p_slot->state = POWEROFF_STATE; ··· 1945 1951 u32 tempdword; 1946 1952 int rc; 1947 1953 struct slot *p_slot; 1948 - int physical_slot = 0; 1949 1954 1950 1955 tempdword = 0; 1951 1956 1952 1957 device = func->device; 1953 1958 hp_slot = device - ctrl->slot_device_offset; 1954 1959 p_slot = cpqhp_find_slot(ctrl, device); 1955 - if (p_slot) 1956 - physical_slot = p_slot->number; 1957 1960 1958 1961 /* Check to see if the interlock is closed */ 1959 1962 tempdword = readl(ctrl->hpc_reg + INT_INPUT_CLEAR); ··· 2034 2043 unsigned int devfn; 2035 2044 struct slot *p_slot; 2036 2045 struct pci_bus *pci_bus = ctrl->pci_bus; 2037 - int physical_slot = 0; 2038 2046 2039 2047 device = func->device; 2040 2048 func = cpqhp_slot_find(ctrl->bus, device, index++); 2041 2049 p_slot = cpqhp_find_slot(ctrl, device); 2042 - if (p_slot) 2043 - physical_slot = p_slot->number; 2044 2050 2045 2051 /* Make sure there are no video controllers here */ 2046 2052 while (func && !rc) {
+1 -1
drivers/pci/hotplug/cpqphp_pci.c
··· 473 473 int sub_bus; 474 474 int max_functions; 475 475 int function = 0; 476 - int cloop = 0; 476 + int cloop; 477 477 int stop_it; 478 478 479 479 ID = 0xFFFFFFFF;