net: netsec: Make use of the helper function dev_err_probe()

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
And using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Cai Huoqing 2021-09-16 15:37:29 +08:00 committed by David S. Miller
parent 8dc84dcd7f
commit 61524e43ab
1 changed files with 9 additions and 12 deletions

View File

@ -1860,10 +1860,9 @@ static int netsec_of_probe(struct platform_device *pdev,
*phy_addr = of_mdio_parse_addr(&pdev->dev, priv->phy_np); *phy_addr = of_mdio_parse_addr(&pdev->dev, priv->phy_np);
priv->clk = devm_clk_get(&pdev->dev, NULL); /* get by 'phy_ref_clk' */ priv->clk = devm_clk_get(&pdev->dev, NULL); /* get by 'phy_ref_clk' */
if (IS_ERR(priv->clk)) { if (IS_ERR(priv->clk))
dev_err(&pdev->dev, "phy_ref_clk not found\n"); return dev_err_probe(&pdev->dev, PTR_ERR(priv->clk),
return PTR_ERR(priv->clk); "phy_ref_clk not found\n");
}
priv->freq = clk_get_rate(priv->clk); priv->freq = clk_get_rate(priv->clk);
return 0; return 0;
@ -1886,19 +1885,17 @@ static int netsec_acpi_probe(struct platform_device *pdev,
priv->phy_interface = PHY_INTERFACE_MODE_NA; priv->phy_interface = PHY_INTERFACE_MODE_NA;
ret = device_property_read_u32(&pdev->dev, "phy-channel", phy_addr); ret = device_property_read_u32(&pdev->dev, "phy-channel", phy_addr);
if (ret) { if (ret)
dev_err(&pdev->dev, return dev_err_probe(&pdev->dev, ret,
"missing required property 'phy-channel'\n"); "missing required property 'phy-channel'\n");
return ret;
}
ret = device_property_read_u32(&pdev->dev, ret = device_property_read_u32(&pdev->dev,
"socionext,phy-clock-frequency", "socionext,phy-clock-frequency",
&priv->freq); &priv->freq);
if (ret) if (ret)
dev_err(&pdev->dev, return dev_err_probe(&pdev->dev, ret,
"missing required property 'socionext,phy-clock-frequency'\n"); "missing required property 'socionext,phy-clock-frequency'\n");
return ret; return 0;
} }
static void netsec_unregister_mdio(struct netsec_priv *priv) static void netsec_unregister_mdio(struct netsec_priv *priv)