From: Yijing Wang <wangyijing@huawei.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: <linux-pci@vger.kernel.org>, Yinghai Lu <yinghai@kernel.org>,
Yijing Wang <wangyijing@huawei.com>
Subject: [PATCH 1/3] PCI: remove the unnecssary checking for pci_bus_add_device
Date: Thu, 29 May 2014 15:01:04 +0800 [thread overview]
Message-ID: <1401346866-11648-2-git-send-email-wangyijing@huawei.com> (raw)
In-Reply-To: <1401346866-11648-1-git-send-email-wangyijing@huawei.com>
Kernel will WARN_ON(retval < 0) if device_attach() fail with
error in pci_bus_add_device(). currently, all the kernel code
to check pci_bus_add_device() return value only for printing
warning message, no other actions. So we can remove the
unnecessary checking codes.
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
drivers/pci/bus.c | 6 +-----
drivers/pci/iov.c | 2 +-
include/linux/pci.h | 2 +-
3 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index ba2bf55..f0efbee 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -266,16 +266,12 @@ void pci_bus_add_devices(const struct pci_bus *bus)
{
struct pci_dev *dev;
struct pci_bus *child;
- int retval;
list_for_each_entry(dev, &bus->devices, bus_list) {
/* Skip already-added devices */
if (dev->is_added)
continue;
- retval = pci_bus_add_device(dev);
- if (retval)
- dev_err(&dev->dev, "Error adding device (%d)\n",
- retval);
+ pci_bus_add_device(dev);
}
list_for_each_entry(dev, &bus->devices, bus_list) {
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index de7a747..cb6f247 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -106,7 +106,7 @@ static int virtfn_add(struct pci_dev *dev, int id, int reset)
pci_device_add(virtfn, virtfn->bus);
mutex_unlock(&iov->dev->sriov->lock);
- rc = pci_bus_add_device(virtfn);
+ pci_bus_add_device(virtfn);
sprintf(buf, "virtfn%u", id);
rc = sysfs_create_link(&dev->dev.kobj, &virtfn->dev.kobj, buf);
if (rc)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 65f22e8..3c4c0cf 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -781,7 +781,7 @@ int pci_scan_slot(struct pci_bus *bus, int devfn);
struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn);
void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);
unsigned int pci_scan_child_bus(struct pci_bus *bus);
-int __must_check pci_bus_add_device(struct pci_dev *dev);
+int pci_bus_add_device(struct pci_dev *dev);
void pci_read_bridge_bases(struct pci_bus *child);
struct resource *pci_find_parent_resource(const struct pci_dev *dev,
struct resource *res);
--
1.7.1
next prev parent reply other threads:[~2014-05-29 7:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-29 7:01 [PATCH 0/3] cleanup unnecessary checking for pci_bus_add_device() Yijing Wang
2014-05-29 7:01 ` Yijing Wang [this message]
2014-05-30 2:07 ` [PATCH 1/3] PCI: remove the unnecssary checking for pci_bus_add_device Bjorn Helgaas
2014-05-30 2:42 ` Yijing Wang
2014-05-29 7:01 ` [PATCH 2/3] platform/x86: remove the unnecessary " Yijing Wang
2014-05-29 7:01 ` [PATCH 3/3] edac: " Yijing Wang
2014-05-29 22:13 ` Yinghai Lu
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=1401346866-11648-2-git-send-email-wangyijing@huawei.com \
--to=wangyijing@huawei.com \
--cc=bhelgaas@google.com \
--cc=linux-pci@vger.kernel.org \
--cc=yinghai@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).