net: stmmac: anarion: clean up anarion_config_dt() error handling

When enabled, print a user friendly description of the error when
failing to ioremap() the control resource, and use ERR_CAST() when
propagating the error. This allows us to get rid of the "err" local
variable in anarion_config_dt().

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1u4FlQ-000XjA-2V@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
pull/1112/head
Russell King (Oracle) 2025-04-14 10:06:00 +01:00 committed by Jakub Kicinski
parent 2f8cc49d86
commit c30a45a7e0
1 changed files with 3 additions and 4 deletions

View File

@ -65,13 +65,12 @@ anarion_config_dt(struct platform_device *pdev,
{
struct anarion_gmac *gmac;
void __iomem *ctl_block;
int err;
ctl_block = devm_platform_ioremap_resource(pdev, 1);
if (IS_ERR(ctl_block)) {
err = PTR_ERR(ctl_block);
dev_err(&pdev->dev, "Cannot get reset region (%d)!\n", err);
return ERR_PTR(err);
dev_err(&pdev->dev, "Cannot get reset region (%pe)!\n",
ctl_block);
return ERR_CAST(ctl_block);
}
gmac = devm_kzalloc(&pdev->dev, sizeof(*gmac), GFP_KERNEL);