Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4611068ybe; Mon, 16 Sep 2019 15:28:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVdmjAFR5b+Cpe9q/KZkYwE6i6Z7OeVtFzGgSNFaS+Seg+rQWw3gKV9Fhe4Cozfd0GFpUj X-Received: by 2002:a17:906:80d9:: with SMTP id a25mr2117202ejx.222.1568672894333; Mon, 16 Sep 2019 15:28:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568672894; cv=none; d=google.com; s=arc-20160816; b=br3ZT6Ngkq7rmt1GIwTVsAmuWcQJIf5JZNd+eRREG8OVvPGfGu4zgPUjNcNzBFzgsZ VuJ2ESBvYC2z3hurMIA69zmcnjjlvLmc36IOyNI3kJxHlOQO+e4nO0a775rdrFSP+v1d uWe7qvQZU6/Mz3fzb0nWmDbHqMkEOSNNtWAb/mfGUwY//gT51VFXLzdVopSL9urEcuAq nL9v4owU2TwI62RPlnLc1wox+ZaIW/Ez0TJOjIcRtL9CXp1YYTT0tmta+PEX1L7xGEnX ivpbtZsNpFq+pTxV8AGTBE35CJrQQZ2kjgYkJLADriBAb78paWAV/Bz5WPILyOYI6nCR obPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=qzo9N5fUquDTsruLiXlDtb8ifZF0psYmg1XFgmwVlAE=; b=ab1p/80b7CKDPUiSZATSSupOmWMALfDn4x4Uw9gSE4jAEPePkb9anoEniMN51J06Da RM7h60Ytc5PIr1Sfm+VFJTrPhIsCRDgsk/frwV27Owmsb/XRlTcKTuusiEmW83hZc2PX RL89NbjAMRx+rJuLEZZB7GYzwpNL/FX7xw01erbjc3vq1xrqtVieRnELsb7L070+vYBq 16vh+y3wrS+lmPKtO1x/iEbyj2t5MISTxjiS9jkfAXSSp+67dggEzN5GvkZpA0k5RY7Z Y3/+ONBpVjL4PLhsGmORXFiLdpOSqTTBxIqUvOkgUbv/WkoBwjGUgveuM3EZpL6TZmb5 /jXQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id by16si261213edb.30.2019.09.16.15.27.51; Mon, 16 Sep 2019 15:28:14 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391548AbfIPUo4 (ORCPT + 99 others); Mon, 16 Sep 2019 16:44:56 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:33212 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733036AbfIPUoz (ORCPT ); Mon, 16 Sep 2019 16:44:55 -0400 Received: by mail-wm1-f65.google.com with SMTP id r17so868397wme.0; Mon, 16 Sep 2019 13:44:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qzo9N5fUquDTsruLiXlDtb8ifZF0psYmg1XFgmwVlAE=; b=ofhXOsH398lqeN7n+lSzzu9Riov/tRnomBHh86IvYZakTibaIk8Fpe4GpTfVe4bUeY 7hcYEKJo6fDkzKf2QzZW+irI9fBta14cih0gTM5lamZKM5Qb0fFQowNTmZM0ly5ZbYoB tzKLlJ5V1bHgCkzjWPFw7kgZmBQGBO2b1XI2o8DaMDEz1wRitnV9AlgqLUTa90RhBUGU eL26hfXpVtkUuU6npfbgnQSRtBpfaHoIKQI7S6pBncHIueE1rFidrN84xFBoqXE8IJVt JGBTbS6cijyFVAlco7LIb6tOdDDtbNT4KJtesL2VlRiTf4VHu4XGAG/X+kz/TRxdl0FE b85Q== X-Gm-Message-State: APjAAAUukmtejsNnYlsfwQ1rqGMWEUGBK43hU2L97RLcCjPRADQ7ZtXg rpf8fcR7byhZjPLAKx5Ox84= X-Received: by 2002:a7b:cbd0:: with SMTP id n16mr661540wmi.82.1568666693707; Mon, 16 Sep 2019 13:44:53 -0700 (PDT) Received: from black.home (broadband-188-32-48-208.ip.moscow.rt.ru. [188.32.48.208]) by smtp.googlemail.com with ESMTPSA id x6sm231437wmf.38.2019.09.16.13.44.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 13:44:53 -0700 (PDT) From: Denis Efremov To: Bjorn Helgaas Cc: Denis Efremov , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Andrew Murray , netdev@vger.kernel.org, Jose Abreu Subject: [PATCH v3 11/26] net: dwc-xlgmac: Loop using PCI_STD_NUM_BARS Date: Mon, 16 Sep 2019 23:41:43 +0300 Message-Id: <20190916204158.6889-12-efremov@linux.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190916204158.6889-1-efremov@linux.com> References: <20190916204158.6889-1-efremov@linux.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Refactor loops to use idiomatic C style and avoid the fencepost error of using "i < PCI_STD_RESOURCE_END" when "i <= PCI_STD_RESOURCE_END" is required, e.g., commit 2f686f1d9bee ("PCI: Correct PCI_STD_RESOURCE_END usage"). To iterate through all possible BARs, loop conditions changed to the *number* of BARs "i < PCI_STD_NUM_BARS", instead of the index of the last valid BAR "i <= PCI_STD_RESOURCE_END". Cc: Jose Abreu Signed-off-by: Denis Efremov --- drivers/net/ethernet/synopsys/dwc-xlgmac-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/synopsys/dwc-xlgmac-pci.c b/drivers/net/ethernet/synopsys/dwc-xlgmac-pci.c index 386bafe74c3f..fa8604d7b797 100644 --- a/drivers/net/ethernet/synopsys/dwc-xlgmac-pci.c +++ b/drivers/net/ethernet/synopsys/dwc-xlgmac-pci.c @@ -34,7 +34,7 @@ static int xlgmac_probe(struct pci_dev *pcidev, const struct pci_device_id *id) return ret; } - for (i = 0; i <= PCI_STD_RESOURCE_END; i++) { + for (i = 0; i < PCI_STD_NUM_BARS; i++) { if (pci_resource_len(pcidev, i) == 0) continue; ret = pcim_iomap_regions(pcidev, BIT(i), XLGMAC_DRV_NAME); -- 2.21.0