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 <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Reviewed-by: Yanteng Si <[email protected]> Reviewed-by: Huacai Chen <[email protected]> Tested-by: Henry Chen <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 071ccde commit 9db2426

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

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)