From: Philipp Stanner <phasta@kernel.org>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Huacai Chen <chenhuacai@kernel.org>,
Yanteng Si <si.yanteng@linux.dev>,
Serge Semin <fancer.lancer@gmail.com>,
Yinggang Gu <guyinggang@loongson.cn>
Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Philipp Stanner <phasta@kernel.org>,
Andrew Lunn <andrew@lunn.ch>,
Huacai Chen <chenhuacai@loongson.cn>,
Henry Chen <chenx97@aosc.io>,
Jacob Keller <jacob.e.keller@intel.com>
Subject: [PATCH net-next v4 1/3] stmmac: loongson: Remove surplus loop
Date: Mon, 24 Mar 2025 10:29:28 +0100 [thread overview]
Message-ID: <20250324092928.9482-4-phasta@kernel.org> (raw)
In-Reply-To: <20250324092928.9482-2-phasta@kernel.org>
loongson_dwmac_probe() contains a loop which doesn't have an effect,
because it tries to call pcim_iomap_regions() with the same parameters
several times. The break statement at the loop's end furthermore ensures
that the loop only runs once anyways.
Remove the surplus loop.
Signed-off-by: Philipp Stanner <phasta@kernel.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Yanteng Si <si.yanteng@linux.dev>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Tested-by: Henry Chen <chenx97@aosc.io>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
---
.../net/ethernet/stmicro/stmmac/dwmac-loongson.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
index f1c62f237e58..7e8495547934 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
@@ -536,7 +536,7 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
struct stmmac_pci_info *info;
struct stmmac_resources res;
struct loongson_data *ld;
- int ret, i;
+ int ret;
plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
if (!plat)
@@ -566,14 +566,9 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
pci_set_master(pdev);
/* Get the base address of device */
- for (i = 0; i < PCI_STD_NUM_BARS; i++) {
- if (pci_resource_len(pdev, i) == 0)
- continue;
- ret = pcim_iomap_regions(pdev, BIT(0), DRIVER_NAME);
- if (ret)
- goto err_disable_device;
- break;
- }
+ ret = pcim_iomap_regions(pdev, BIT(0), DRIVER_NAME);
+ if (ret)
+ goto err_disable_device;
memset(&res, 0, sizeof(res));
res.addr = pcim_iomap_table(pdev)[0];
--
2.48.1
next prev parent reply other threads:[~2025-03-24 9:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-24 9:29 [PATCH net-next v4 0/3] stmmac: Several PCI-related improvements Philipp Stanner
2025-03-24 9:29 ` Philipp Stanner [this message]
2025-03-24 9:29 ` [PATCH net-next v4 2/3] stmmac: Remove pcim_* functions for driver detach Philipp Stanner
2025-03-24 9:29 ` [PATCH net-next v4 3/3] stmmac: Replace deprecated PCI functions Philipp Stanner
2025-03-25 17:50 ` [PATCH net-next v4 0/3] stmmac: Several PCI-related improvements patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250324092928.9482-4-phasta@kernel.org \
--to=phasta@kernel.org \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=chenhuacai@kernel.org \
--cc=chenhuacai@loongson.cn \
--cc=chenx97@aosc.io \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fancer.lancer@gmail.com \
--cc=guyinggang@loongson.cn \
--cc=jacob.e.keller@intel.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=si.yanteng@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.