All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next RESEND] net: fec: Do proper error checking for enet_out clk
@ 2022-05-20  6:26 Uwe Kleine-König
  2022-05-20 20:20 ` Andrew Lunn
  2022-05-22 21:00 ` [PATCH net-next RESEND] net: fec: Do proper error checking for enet_out clk patchwork-bot+netdevbpf
  0 siblings, 2 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2022-05-20  6:26 UTC (permalink / raw)
  To: Joakim Zhang, David S. Miller, Jakub Kicinski
  Cc: netdev, NXP Linux Team, kernel

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>
---
Hello,

I sent this back in March and was asked to resend after the merge window
closed. Actually I intended to do this earlier, but it got lost in my
todo list and I found it just now. (And after all it is still after the
merge window and http://vger.kernel.org/~davem/net-next.html claims it's
still time ... :-)

Best regards
Uwe

 drivers/net/ethernet/freescale/fec_main.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 11227f51404c..2512b68d8545 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -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);

base-commit: 3123109284176b1532874591f7c81f3837bbdc17
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-05-22 21:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-20  6:26 [PATCH net-next RESEND] net: fec: Do proper error checking for enet_out clk Uwe Kleine-König
2022-05-20 20:20 ` Andrew Lunn
2022-05-21  8:34   ` [PATCH v2] net: fec: Do proper error checking for optional clks Uwe Kleine-König
2022-05-21 14:26     ` Andrew Lunn
2022-05-22 20:50     ` patchwork-bot+netdevbpf
2022-05-22 21:00 ` [PATCH net-next RESEND] net: fec: Do proper error checking for enet_out clk patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.