summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/cadence
diff options
context:
space:
mode:
authorConor Dooley <conor.dooley@microchip.com>2022-07-06 10:51:28 +0100
committerJakub Kicinski <kuba@kernel.org>2022-07-07 20:01:50 -0700
commitea242f821a2d0d55e275b9618f9628bcc30867a2 (patch)
treea8bfb0872f51b7c32a044fa7644e568042e5f360 /drivers/net/ethernet/cadence
parent649bef9c7663f23f8813b8b26d615ffc0df64787 (diff)
net: macb: simplify error paths in init_reset_optional()
The error handling paths in init_reset_optional() can all be simplified to return dev_err_probe(). Do so. Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com> Signed-off-by: Conor Dooley <conor.dooley@microchip.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ethernet/cadence')
-rw-r--r--drivers/net/ethernet/cadence/macb_main.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 5dfa8b81167f..f28e3ad35194 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4699,27 +4699,21 @@ static int init_reset_optional(struct platform_device *pdev)
/* Ensure PHY device used in SGMII mode is ready */
bp->sgmii_phy = devm_phy_optional_get(&pdev->dev, NULL);
- if (IS_ERR(bp->sgmii_phy)) {
- ret = PTR_ERR(bp->sgmii_phy);
- dev_err_probe(&pdev->dev, ret,
- "failed to get SGMII PHY\n");
- return ret;
- }
+ if (IS_ERR(bp->sgmii_phy))
+ return dev_err_probe(&pdev->dev, PTR_ERR(bp->sgmii_phy),
+ "failed to get SGMII PHY\n");
ret = phy_init(bp->sgmii_phy);
- if (ret) {
- dev_err(&pdev->dev, "failed to init SGMII PHY: %d\n",
- ret);
- return ret;
- }
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret,
+ "failed to init SGMII PHY\n");
}
/* Fully reset controller at hardware level if mapped in device tree */
ret = device_reset_optional(&pdev->dev);
if (ret) {
- dev_err_probe(&pdev->dev, ret, "failed to reset controller");
phy_exit(bp->sgmii_phy);
- return ret;
+ return dev_err_probe(&pdev->dev, ret, "failed to reset controller");
}
ret = macb_init(pdev);