Skip to content

Commit

Permalink
net: fec: Do proper error checking for enet_out clk
Browse files Browse the repository at this point in the history
An error code returned by devm_clk_get() might have other meanings than
"This clock doesn't exist". So use devm_clk_get_optional() and handle
all remaining errors as fatal.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Uwe Kleine-König authored and David S. Miller committed May 22, 2022
1 parent 621427f commit 5ff851b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/net/ethernet/freescale/fec_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3866,9 +3866,11 @@ fec_probe(struct platform_device *pdev)
fep->itr_clk_rate = clk_get_rate(fep->clk_ahb);

/* enet_out is optional, depends on board */
fep->clk_enet_out = devm_clk_get(&pdev->dev, "enet_out");
if (IS_ERR(fep->clk_enet_out))
fep->clk_enet_out = NULL;
fep->clk_enet_out = devm_clk_get_optional(&pdev->dev, "enet_out");
if (IS_ERR(fep->clk_enet_out)) {
ret = PTR_ERR(fep->clk_enet_out);
goto failed_clk;
}

fep->ptp_clk_on = false;
mutex_init(&fep->ptp_clk_mutex);
Expand Down

0 comments on commit 5ff851b

Please sign in to comment.