Skip to content

Commit c50762a

Browse files
committed
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>
1 parent cb2d0f8 commit c50762a

3 files changed

Lines changed: 2 additions & 11 deletions

File tree

drivers/pci/pci-sysfs.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -754,8 +754,6 @@ static ssize_t pci_read_config(struct file *filp, struct kobject *kobj,
754754
u8 val;
755755
pci_user_read_config_byte(dev, off, &val);
756756
data[off - init_off] = val;
757-
off++;
758-
--size;
759757
}
760758

761759
pci_config_pm_runtime_put(dev);
@@ -818,11 +816,8 @@ static ssize_t pci_write_config(struct file *filp, struct kobject *kobj,
818816
size -= 2;
819817
}
820818

821-
if (size) {
819+
if (size)
822820
pci_user_write_config_byte(dev, off, data[off - init_off]);
823-
off++;
824-
--size;
825-
}
826821

827822
pci_config_pm_runtime_put(dev);
828823

drivers/pci/proc.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ static ssize_t proc_bus_pci_read(struct file *file, char __user *buf,
9999
unsigned char val;
100100
pci_user_read_config_byte(dev, pos, &val);
101101
__put_user(val, buf);
102-
buf++;
103102
pos++;
104-
cnt--;
105103
}
106104

107105
pci_config_pm_runtime_put(dev);
@@ -176,9 +174,7 @@ static ssize_t proc_bus_pci_write(struct file *file, const char __user *buf,
176174
unsigned char val;
177175
__get_user(val, buf);
178176
pci_user_write_config_byte(dev, pos, val);
179-
buf++;
180177
pos++;
181-
cnt--;
182178
}
183179

184180
pci_config_pm_runtime_put(dev);

drivers/pci/setup-bus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1525,7 +1525,7 @@ static void pci_bridge_release_resources(struct pci_bus *bus,
15251525
{
15261526
struct pci_dev *dev = bus->self;
15271527
struct resource *r;
1528-
unsigned int old_flags = 0;
1528+
unsigned int old_flags;
15291529
struct resource *b_res;
15301530
int idx = 1;
15311531

0 commit comments

Comments
 (0)