Skip to content

Commit 61524e4

Browse files
caihuoqing1990davem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8dc84dc commit 61524e4

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

drivers/net/ethernet/socionext/netsec.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,10 +1860,9 @@ static int netsec_of_probe(struct platform_device *pdev,
18601860
*phy_addr = of_mdio_parse_addr(&pdev->dev, priv->phy_np);
18611861

18621862
priv->clk = devm_clk_get(&pdev->dev, NULL); /* get by 'phy_ref_clk' */
1863-
if (IS_ERR(priv->clk)) {
1864-
dev_err(&pdev->dev, "phy_ref_clk not found\n");
1865-
return PTR_ERR(priv->clk);
1866-
}
1863+
if (IS_ERR(priv->clk))
1864+
return dev_err_probe(&pdev->dev, PTR_ERR(priv->clk),
1865+
"phy_ref_clk not found\n");
18671866
priv->freq = clk_get_rate(priv->clk);
18681867

18691868
return 0;
@@ -1886,19 +1885,17 @@ static int netsec_acpi_probe(struct platform_device *pdev,
18861885
priv->phy_interface = PHY_INTERFACE_MODE_NA;
18871886

18881887
ret = device_property_read_u32(&pdev->dev, "phy-channel", phy_addr);
1889-
if (ret) {
1890-
dev_err(&pdev->dev,
1891-
"missing required property 'phy-channel'\n");
1892-
return ret;
1893-
}
1888+
if (ret)
1889+
return dev_err_probe(&pdev->dev, ret,
1890+
"missing required property 'phy-channel'\n");
18941891

18951892
ret = device_property_read_u32(&pdev->dev,
18961893
"socionext,phy-clock-frequency",
18971894
&priv->freq);
18981895
if (ret)
1899-
dev_err(&pdev->dev,
1900-
"missing required property 'socionext,phy-clock-frequency'\n");
1901-
return ret;
1896+
return dev_err_probe(&pdev->dev, ret,
1897+
"missing required property 'socionext,phy-clock-frequency'\n");
1898+
return 0;
19021899
}
19031900

19041901
static void netsec_unregister_mdio(struct netsec_priv *priv)

0 commit comments

Comments
 (0)