No, if res is NULL, devm_platform_get_and_ioremap_resource() returns failed.- dev->regs = devm_ioremap_resource(&pdev->dev, res);Here, only dev->regs is considered.
+ dev->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
if (IS_ERR(dev->regs)) {
dev_err(&pdev->dev, "Unable to map MIIM registers\n");
return PTR_ERR(dev->regs);
}
+ dev->phy_regs = devm_platform_get_and_ioremap_resource(pdev, 1, &res);Here you look at both res and dev->phy_regs.
+ if (res && IS_ERR(dev->phy_regs)) {
This seems inconsistent. Can devm_platform_get_and_ioremap_resource()
return success despite res being NULL?
Andrew
.