From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D27F6C4CECE for ; Mon, 16 Sep 2019 20:44:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A9252206A4 for ; Mon, 16 Sep 2019 20:44:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391553AbfIPUo5 (ORCPT ); Mon, 16 Sep 2019 16:44:57 -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-Google-Smtp-Source: APXvYqyubIyIdrlstzf0Ad0JsGLLntibKR539vulOFUOeqSof1ITb8rIBEpmhXOL5xtxwKIsovzmNA== 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