[PATCH] stmmac: Replace deprecated PCI functions

Andrew Lunn andrew at lunn.ch
Wed Feb 12 10:13:42 PST 2025


>  	/* 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), pci_name(pdev));
> -		if (ret)
> -			goto err_disable_device;
> -		break;
> -	}
> -
> -	memset(&res, 0, sizeof(res));
> -	res.addr = pcim_iomap_table(pdev)[0];
> +	res.addr = pcim_iomap_region(pdev, 0, DRIVER_NAME);

I don't know too much about PCI, but this change does not look
obviously correct to me. Maybe the commit message needs expanding to
explain why the loop can be thrown away? Also, is that BIT(0) actually
wrong, it should of been BIT(i)? Is that why the loop is pointless and
can be removed? If so, we should be asking the developer of this code
what are the implications of the bug. Should the loop be kept?

	Andrew



More information about the linux-arm-kernel mailing list