Skip to content

Commit 9db2426

Browse files
Philipp Stannerkuba-moo
authored andcommitted
stmmac: loongson: Remove surplus loop
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> Link: https://patch.msgid.link/20250324092928.9482-4-phasta@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 071ccde commit 9db2426

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
536536
struct stmmac_pci_info *info;
537537
struct stmmac_resources res;
538538
struct loongson_data *ld;
539-
int ret, i;
539+
int ret;
540540

541541
plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
542542
if (!plat)
@@ -566,14 +566,9 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
566566
pci_set_master(pdev);
567567

568568
/* Get the base address of device */
569-
for (i = 0; i < PCI_STD_NUM_BARS; i++) {
570-
if (pci_resource_len(pdev, i) == 0)
571-
continue;
572-
ret = pcim_iomap_regions(pdev, BIT(0), DRIVER_NAME);
573-
if (ret)
574-
goto err_disable_device;
575-
break;
576-
}
569+
ret = pcim_iomap_regions(pdev, BIT(0), DRIVER_NAME);
570+
if (ret)
571+
goto err_disable_device;
577572

578573
memset(&res, 0, sizeof(res));
579574
res.addr = pcim_iomap_table(pdev)[0];

0 commit comments

Comments
 (0)