diff mbox series

[1/5] PCI: Remove unused assignments

Message ID 20220313192933.434746-2-helgaas@kernel.org (mailing list archive)
State Accepted
Commit 2f50869846238bab5717cbd8377a095264d4acc2
Headers show
Series PCI: Remove unused assignments | expand

Commit Message

Bjorn Helgaas March 13, 2022, 7:29 p.m. UTC
From: Bjorn Helgaas <bhelgaas@google.com>

Remove variables and assignments that are never used.

Found by Krzysztof WilczyƄski <kw@linux.com> 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.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/pci-sysfs.c | 7 +------
 drivers/pci/proc.c      | 4 ----
 drivers/pci/setup-bus.c | 2 +-
 3 files changed, 2 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 602f0fb0b007..c263ffc5884a 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -754,8 +754,6 @@  static ssize_t pci_read_config(struct file *filp, struct kobject *kobj,
 		u8 val;
 		pci_user_read_config_byte(dev, off, &val);
 		data[off - init_off] = val;
-		off++;
-		--size;
 	}
 
 	pci_config_pm_runtime_put(dev);
@@ -818,11 +816,8 @@  static ssize_t pci_write_config(struct file *filp, struct kobject *kobj,
 		size -= 2;
 	}
 
-	if (size) {
+	if (size)
 		pci_user_write_config_byte(dev, off, data[off - init_off]);
-		off++;
-		--size;
-	}
 
 	pci_config_pm_runtime_put(dev);
 
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c
index 1a5b75399aa5..31b26d8ea6cc 100644
--- a/drivers/pci/proc.c
+++ b/drivers/pci/proc.c
@@ -99,9 +99,7 @@  static ssize_t proc_bus_pci_read(struct file *file, char __user *buf,
 		unsigned char val;
 		pci_user_read_config_byte(dev, pos, &val);
 		__put_user(val, buf);
-		buf++;
 		pos++;
-		cnt--;
 	}
 
 	pci_config_pm_runtime_put(dev);
@@ -176,9 +174,7 @@  static ssize_t proc_bus_pci_write(struct file *file, const char __user *buf,
 		unsigned char val;
 		__get_user(val, buf);
 		pci_user_write_config_byte(dev, pos, val);
-		buf++;
 		pos++;
-		cnt--;
 	}
 
 	pci_config_pm_runtime_put(dev);
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 547396ec50b5..3290b64ea9f0 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -1525,7 +1525,7 @@  static void pci_bridge_release_resources(struct pci_bus *bus,
 {
 	struct pci_dev *dev = bus->self;
 	struct resource *r;
-	unsigned int old_flags = 0;
+	unsigned int old_flags;
 	struct resource *b_res;
 	int idx = 1;