From: Bjorn Helgaas <helgaas@kernel.org>
To: linux-pci@vger.kernel.org
Cc: "Krzysztof Wilczyński" <kw@linux.com>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Greentime Hu" <greentime.hu@sifive.com>,
"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
"Rob Herring" <robh@kernel.org>,
"Xiaowei Song" <songxiaowei@hisilicon.com>,
"Binghui Wang" <wangbinghui@hisilicon.com>,
"Bjorn Helgaas" <bhelgaas@google.com>
Subject: [PATCH 1/5] PCI: Remove unused assignments
Date: Sun, 13 Mar 2022 14:29:29 -0500 [thread overview]
Message-ID: <20220313192933.434746-2-helgaas@kernel.org> (raw)
In-Reply-To: <20220313192933.434746-1-helgaas@kernel.org>
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 --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;
--
2.25.1
next prev parent reply other threads:[~2022-03-13 19:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-13 19:29 [PATCH 0/5] PCI: Remove unused assignments Bjorn Helgaas
2022-03-13 19:29 ` Bjorn Helgaas [this message]
2022-03-13 19:29 ` [PATCH 2/5] PCI: kirin: " Bjorn Helgaas
2022-03-13 19:29 ` [PATCH 3/5] PCI: fu740: " Bjorn Helgaas
2022-03-13 19:29 ` [PATCH 4/5] PCI: cpqphp: " Bjorn Helgaas
2022-03-13 19:29 ` [PATCH 5/5] PCI: ibmphp: " Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220313192933.434746-2-helgaas@kernel.org \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=greentime.hu@sifive.com \
--cc=kw@linux.com \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=paul.walmsley@sifive.com \
--cc=robh@kernel.org \
--cc=songxiaowei@hisilicon.com \
--cc=wangbinghui@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.