diff mbox series

[net-next] net: fec: Do proper error checking for enet_out clk

Message ID 20220325165543.33963-1-u.kleine-koenig@pengutronix.de (mailing list archive)
State Deferred
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: fec: Do proper error checking for enet_out clk | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 1 maintainers not CCed: pabeni@redhat.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 14 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Uwe Kleine-König March 25, 2022, 4:55 p.m. UTC
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,

this isn't urgent and doesn't fix a problem I encountered, just noticed
this patch opportunity while looking up something different in the
driver.

Best regards
Uwe

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

Comments

Jakub Kicinski March 28, 2022, 11:09 p.m. UTC | #1
On Fri, 25 Mar 2022 17:55:43 +0100 Uwe Kleine-König wrote:
> 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,
> 
> this isn't urgent and doesn't fix a problem I encountered, just noticed
> this patch opportunity while looking up something different in the
> driver.

Would you mind reposting after the merge window? 
We keep net-next closed until -rc1 is cut.
Uwe Kleine-König March 29, 2022, 5:47 a.m. UTC | #2
On Mon, Mar 28, 2022 at 04:09:10PM -0700, Jakub Kicinski wrote:
> On Fri, 25 Mar 2022 17:55:43 +0100 Uwe Kleine-König wrote:
> > 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,
> > 
> > this isn't urgent and doesn't fix a problem I encountered, just noticed
> > this patch opportunity while looking up something different in the
> > driver.
> 
> Would you mind reposting after the merge window? 
> We keep net-next closed until -rc1 is cut.

I somehow expected there is an implicit queue of patches that is
processed once net-next opens again. But sure, will resend after -rc1.

Best regards
Uwe
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 796133de527e..b0500ecd4ee8 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);