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

PCI: Remove unused assignments

Remove variables and assignments that are never used.

Found by Krzysztof using cppcheck, e.g.,

$ cppcheck --enable=all --force
uselessAssignmentPtrArg drivers/pci/proc.c:102 Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
unreadVariable drivers/pci/setup-bus.c:1528 Variable 'old_flags' is assigned a value that is never used.

Reported-by: Krzysztof Wilczyński <kw@linux.com>
Link: https://lore.kernel.org/r/20220313192933.434746-2-helgaas@kernel.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

+2 -11
+1 -6
drivers/pci/pci-sysfs.c
··· 754 754 u8 val; 755 755 pci_user_read_config_byte(dev, off, &val); 756 756 data[off - init_off] = val; 757 - off++; 758 - --size; 759 757 } 760 758 761 759 pci_config_pm_runtime_put(dev); ··· 816 818 size -= 2; 817 819 } 818 820 819 - if (size) { 821 + if (size) 820 822 pci_user_write_config_byte(dev, off, data[off - init_off]); 821 - off++; 822 - --size; 823 - } 824 823 825 824 pci_config_pm_runtime_put(dev); 826 825
-4
drivers/pci/proc.c
··· 99 99 unsigned char val; 100 100 pci_user_read_config_byte(dev, pos, &val); 101 101 __put_user(val, buf); 102 - buf++; 103 102 pos++; 104 - cnt--; 105 103 } 106 104 107 105 pci_config_pm_runtime_put(dev); ··· 174 176 unsigned char val; 175 177 __get_user(val, buf); 176 178 pci_user_write_config_byte(dev, pos, val); 177 - buf++; 178 179 pos++; 179 - cnt--; 180 180 } 181 181 182 182 pci_config_pm_runtime_put(dev);
+1 -1
drivers/pci/setup-bus.c
··· 1525 1525 { 1526 1526 struct pci_dev *dev = bus->self; 1527 1527 struct resource *r; 1528 - unsigned int old_flags = 0; 1528 + unsigned int old_flags; 1529 1529 struct resource *b_res; 1530 1530 int idx = 1; 1531 1531