diff mbox series

[1/1] net: korina: fix value check in korina_probe()

Message ID 20230726132943.20318-1-ruc_gongyuanjun@163.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [1/1] net: korina: fix value check in korina_probe() | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1356 this patch: 1356
netdev/cc_maintainers fail 1 blamed authors not CCed: tsbogend@alpha.franken.de; 6 maintainers not CCed: geoff@infradead.org wsa+renesas@sang-engineering.com shayagr@amazon.com tsbogend@alpha.franken.de mkl@pengutronix.de nhuck@google.com
netdev/build_clang success Errors and warnings before: 1365 this patch: 1365
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1379 this patch: 1379
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Yuanjun Gong July 26, 2023, 1:29 p.m. UTC
in korina_probe(), check the return value of clk_prepare_enable()
and return the error code if clk_prepare_enable() returns an
unexpected value.

Fixes: e4cd854ec487 ("net: korina: Get mdio input clock via common clock framework")
Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
---
 drivers/net/ethernet/korina.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Jakub Kicinski July 28, 2023, 11:26 p.m. UTC | #1
On Wed, 26 Jul 2023 21:29:43 +0800 Yuanjun Gong wrote:
>	clk = devm_clk_get_optional(&pdev->dev, "mdioclk");

Why not switch this to devm_clk_get_optional_enabled() instead?
Error already handled, makes the code shorter..

>  	if (IS_ERR(clk))
>  		return PTR_ERR(clk);
>  	if (clk) {
> -		clk_prepare_enable(clk);
> +		rc = clk_prepare_enable(clk);
> +		if (rc)
> +			return rc;
diff mbox series

Patch

diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c
index 2b9335cb4bb3..e18062007ae3 100644
--- a/drivers/net/ethernet/korina.c
+++ b/drivers/net/ethernet/korina.c
@@ -1306,7 +1306,9 @@  static int korina_probe(struct platform_device *pdev)
 	if (IS_ERR(clk))
 		return PTR_ERR(clk);
 	if (clk) {
-		clk_prepare_enable(clk);
+		rc = clk_prepare_enable(clk);
+		if (rc)
+			return rc;
 		lp->mii_clock_freq = clk_get_rate(clk);
 	} else {
 		lp->mii_clock_freq = 200000000; /* max possible input clk */