From patchwork Thu Aug 17 02:25:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ding Tianhong X-Patchwork-Id: 110290 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1576543qge; Wed, 16 Aug 2017 19:26:18 -0700 (PDT) X-Received: by 10.98.149.71 with SMTP id p68mr3643485pfd.228.1502936778160; Wed, 16 Aug 2017 19:26:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502936778; cv=none; d=google.com; s=arc-20160816; b=QD7luH6DZ4dnmY/cB/KxQH6NqoYbbF8KZk5+3YMK1vEqPxmTbjCFYW3ZXnVC277hPr K0Jt/I/zFxpV0/o0g//BzgigbPfvX9vb4Jfm+30rGGIu9Z68GBr8vMzfM+nif19ysn/2 DmoNTQmYxBRX/7jitg+YeZvWS1QLVN6y4b2TZvH98H3jj5lxIaD6R7gqwIxu5vpiXVoB 1Cjpqjay2v91xu61sSOuqnVn9kqpr0a3XVE3VTvLJTtYa3i0yGdZlO5naJLbmk0+KQKb r0uDEj6tUz5qd30BXCeq3wHjkz8jfvSq8GQHcLGZ83GsaeIgGgVKS0sl0HORojcdQ/HJ vQGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=nYNQ/bBzUntbXxyVWs7h8IVsgS7L2GZvQsfzmZWtpgw=; b=r/LRdTkoebR5JUSFmqEBWlxGw6ZV3HUJxdY1jfRs7RFRNkB7AqfGXmPYHLYhaHZW11 1AflsGEaTjtRCSYNu5CzhkuWAN5Vnuya51XZersW0TNmYxftv5i7qjba9vbItVGbjMTk uJOEf2HM3TJyASCy9f92DmKggQLKLuWwoUPTS4zlkkPb5FO0dN4EZSFdd5hTRsNHRLt7 zezreOPHd+pU7XLtDhIHpDPPvMa0WvOIjCzRccvYcPkTmEC6faAo7ADxwyUfdj1KSW0i N5hCw9Z3hycjT7ipm8xFuI4uM177OItDWtNPB2G5WyUJjZddD5dCamDfLzIsEAobUVi7 njoQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y7si1295538pgr.175.2017.08.16.19.26.17; Wed, 16 Aug 2017 19:26:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752328AbdHQC0P (ORCPT + 7 others); Wed, 16 Aug 2017 22:26:15 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3574 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751943AbdHQC0N (ORCPT ); Wed, 16 Aug 2017 22:26:13 -0400 Received: from 172.30.72.60 (EHLO DGGEMS407-HUB.china.huawei.com) ([172.30.72.60]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DFK11069; Thu, 17 Aug 2017 10:25:54 +0800 (CST) Received: from localhost (10.177.23.32) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.301.0; Thu, 17 Aug 2017 10:25:41 +0800 From: Ding Tianhong To: , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Ding Tianhong , Thierry Reding Subject: [PATCH net] PCI: fix the return value for the pci_find_pcie_root_port() Date: Thu, 17 Aug 2017 10:25:30 +0800 Message-ID: <1502936730-7368-1-git-send-email-dingtianhong@huawei.com> X-Mailer: git-send-email 1.8.5.2.msysgit.0 MIME-Version: 1.0 X-Originating-IP: [10.177.23.32] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.5994FEB3.01A2, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: db37463305566693fad6b0653276d232 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The pci_find_pcie_root_port() would return NULL if the given dev is already a Root Port, it looks like unfriendly to the PCIe Root Port device, Thierry and Bjorn suggest to let this function return the given dev under this circumstances. Fixes: 0e405232871d6 ("PCI: fix oops when try to find Root Port for a PCI device") Suggested-by: Thierry Reding Suggested-by: Bjorn Helgaas Signed-off-by: Thierry Reding Signed-off-by: Ding Tianhong --- drivers/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 1.8.3.1 diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 7e2022f..352bb53 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -514,7 +514,7 @@ struct resource *pci_find_resource(struct pci_dev *dev, struct resource *res) */ struct pci_dev *pci_find_pcie_root_port(struct pci_dev *dev) { - struct pci_dev *bridge, *highest_pcie_bridge = NULL; + struct pci_dev *bridge, *highest_pcie_bridge = dev; bridge = pci_upstream_bridge(dev); while (bridge && pci_is_pcie(bridge)) {