Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3172569ybi; Fri, 5 Jul 2019 03:08:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqy1n8NuHxKGHQ2bbyKoNwfC6V/Nn9kdbkn/VgoV4ZK9WZjEvBjBAVM0rwjYL8i7JsfbBk1j X-Received: by 2002:a17:902:8d92:: with SMTP id v18mr4475791plo.211.1562321301795; Fri, 05 Jul 2019 03:08:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562321301; cv=none; d=google.com; s=arc-20160816; b=VWpRsprVO2wf+B+zFREiMc3qL8dAQtTpwwhfBCXQaNdDJKA38Hkwutb76JPZwm1MlO X1KdkXJc8NpxO75H+S1OEpY2z3NgJvrmv2DtcDVgPXvHsTWM6zwWiRZq7t7/sMHFbcm7 lCx/8MT9q+tMgJoEqRBUM0Jj4MEttW/5EbtrhKLIkwcm8DbEie8RgsZ4WBGf0FDtiCFW DQfbbw8fMS2PDp7SNUdG0wSbojsg6WwIqKERSBFumpw9uaMtierzMSmRpVztLY8Pa2oj tCWJyxYSsNq3dXSndiqAk9IhYI7HizH4CBIjrUf3bCZRNubxf7cGZTxJ8YCNU6rBL5NX CQaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=iWtIwe6VuQKPO/zZtnjvYA9s7qTxDs1Y+nef1iEuKkg=; b=fuoEQ7L+6fy4fOe4PvZPOUIf/WbQFKWl31N6ZY5D7PPSTGm1h3ggajY/cCRq6sPOyh /2cezu/jcxKJfjTJb+T/DK1PWJVozsEgLId3EawM8i43p0ASwNPEbBqqRVBc8D0gCNHt hh29OqnebKMVdl36JuHN+hIFI2K4x9knLpsVOp5pGdWYjgOLHqfsxH3C8N/0j0j1iOdw 6hA0Hf4S74mqbNgNhs/gFXurPlfhUMFmFX5WL4reSBN5Ku1nB/4MfDPuppMqxU64wNKE 1J+RNf1DJU0TkPn7we46TAEcldmxQuZBPE6olM5ktkurrAYuCQuH8/ixoI9hs8MgEjeQ eFVQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i18si8838990pfa.23.2019.07.05.03.08.06; Fri, 05 Jul 2019 03:08:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728290AbfGEKHa (ORCPT + 99 others); Fri, 5 Jul 2019 06:07:30 -0400 Received: from inva020.nxp.com ([92.121.34.13]:32888 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728213AbfGEKH0 (ORCPT ); Fri, 5 Jul 2019 06:07:26 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id E8E221A0EA4; Fri, 5 Jul 2019 12:07:23 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 6BCA81A0EAB; Fri, 5 Jul 2019 12:07:15 +0200 (CEST) Received: from titan.ap.freescale.net (TITAN.ap.freescale.net [10.192.208.233]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 85B024032B; Fri, 5 Jul 2019 18:07:01 +0800 (SGT) From: Hou Zhiqiang To: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, bhelgaas@google.com, robh+dt@kernel.org, mark.rutland@arm.com, l.subrahmanya@mobiveil.co.in, shawnguo@kernel.org, leoyang.li@nxp.com, lorenzo.pieralisi@arm.com, catalin.marinas@arm.com, will.deacon@arm.com Cc: Mingkai.Hu@nxp.com, Minghuan.Lian@nxp.com, Xiaowei.Bao@nxp.com, Hou Zhiqiang Subject: [PATCHv6 11/28] PCI: mobiveil: Fix devfn check in mobiveil_pcie_valid_device() Date: Fri, 5 Jul 2019 17:56:39 +0800 Message-Id: <20190705095656.19191-12-Zhiqiang.Hou@nxp.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20190705095656.19191-1-Zhiqiang.Hou@nxp.com> References: <20190705095656.19191-1-Zhiqiang.Hou@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Current check for devfn number in mobiveil_pci_valid_device() is wrong in that it flags as invalid functions present in PCI device 0 in the root bus while it is perfectly valid to access all functions in PCI device 0 in the root bus. Update the check in mobiveil_pci_valid_device() to fix the issue. Fixes: 9af6bcb11e12 ("PCI: mobiveil: Add Mobiveil PCIe Host Bridge IP driver") Signed-off-by: Hou Zhiqiang Signed-off-by: Lorenzo Pieralisi Reviewed-by: Minghuan Lian --- V6: - Rebased the patch, no functional change. drivers/pci/controller/pcie-mobiveil.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/pci/controller/pcie-mobiveil.c b/drivers/pci/controller/pcie-mobiveil.c index 8f56130..c9bf565 100644 --- a/drivers/pci/controller/pcie-mobiveil.c +++ b/drivers/pci/controller/pcie-mobiveil.c @@ -283,7 +283,7 @@ static bool mobiveil_pcie_valid_device(struct pci_bus *bus, unsigned int devfn) * Do not read more than one device on the bus directly * attached to RC */ - if ((bus->primary == pcie->root_bus_nr) && (devfn > 0)) + if ((bus->primary == pcie->root_bus_nr) && (PCI_SLOT(devfn) > 0)) return false; return true; -- 1.7.1