From patchwork Thu May 29 07:01:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yijing Wang X-Patchwork-Id: 4262331 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 340F4BF90C for ; Thu, 29 May 2014 07:02:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 640732034B for ; Thu, 29 May 2014 07:02:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 865BA20303 for ; Thu, 29 May 2014 07:02:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756241AbaE2HCR (ORCPT ); Thu, 29 May 2014 03:02:17 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:6415 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755951AbaE2HCP (ORCPT ); Thu, 29 May 2014 03:02:15 -0400 Received: from 172.24.2.119 (EHLO szxeml214-edg.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id APH28984; Thu, 29 May 2014 15:02:12 +0800 (CST) Received: from SZXEML421-HUB.china.huawei.com (10.82.67.160) by szxeml214-edg.china.huawei.com (172.24.2.29) with Microsoft SMTP Server (TLS) id 14.3.158.1; Thu, 29 May 2014 15:02:09 +0800 Received: from localhost (10.177.27.212) by szxeml421-hub.china.huawei.com (10.82.67.160) with Microsoft SMTP Server id 14.3.158.1; Thu, 29 May 2014 15:02:02 +0800 From: Yijing Wang To: Bjorn Helgaas CC: , Yinghai Lu , Yijing Wang Subject: [PATCH 1/3] PCI: remove the unnecssary checking for pci_bus_add_device Date: Thu, 29 May 2014 15:01:04 +0800 Message-ID: <1401346866-11648-2-git-send-email-wangyijing@huawei.com> X-Mailer: git-send-email 1.7.11.msysgit.1 In-Reply-To: <1401346866-11648-1-git-send-email-wangyijing@huawei.com> References: <1401346866-11648-1-git-send-email-wangyijing@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.27.212] X-CFilter-Loop: Reflected Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);