Skip to content

Commit 0b6291a

Browse files
AnnYugawakuba-moo
authored andcommitted
net: korina: handle clk prepare error in korina_probe()
in korina_probe(), the return value of clk_prepare_enable() should be checked since it might fail. we can use devm_clk_get_optional_enabled() instead of devm_clk_get_optional() and clk_prepare_enable() to automatically handle the error. Fixes: e4cd854 ("net: korina: Get mdio input clock via common clock framework") Signed-off-by: Yuanjun Gong <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent b99225b commit 0b6291a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/net/ethernet/korina.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,11 +1302,10 @@ static int korina_probe(struct platform_device *pdev)
13021302
else if (of_get_ethdev_address(pdev->dev.of_node, dev) < 0)
13031303
eth_hw_addr_random(dev);
13041304

1305-
clk = devm_clk_get_optional(&pdev->dev, "mdioclk");
1305+
clk = devm_clk_get_optional_enabled(&pdev->dev, "mdioclk");
13061306
if (IS_ERR(clk))
13071307
return PTR_ERR(clk);
13081308
if (clk) {
1309-
clk_prepare_enable(clk);
13101309
lp->mii_clock_freq = clk_get_rate(clk);
13111310
} else {
13121311
lp->mii_clock_freq = 200000000; /* max possible input clk */

0 commit comments

Comments
 (0)