Skip to content

Commit 4c5107b

Browse files
nehebkuba-moo
authored andcommitted
net: marvell: mvmdio: use clk_get_optional
The code seems to be handling EPROBE_DEFER explicitly and if there's no error, enables the clock. clk_get_optional exists for that. Signed-off-by: Rosen Penev <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent b7074e4 commit 4c5107b

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

drivers/net/ethernet/marvell/mvmdio.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -348,13 +348,12 @@ static int orion_mdio_probe(struct platform_device *pdev)
348348
if (type == BUS_TYPE_XSMI)
349349
orion_mdio_xsmi_set_mdc_freq(bus);
350350
} else {
351-
dev->clk[0] = clk_get(&pdev->dev, NULL);
352-
if (PTR_ERR(dev->clk[0]) == -EPROBE_DEFER) {
353-
ret = -EPROBE_DEFER;
351+
dev->clk[0] = clk_get_optional(&pdev->dev, NULL);
352+
if (IS_ERR(dev->clk[0])) {
353+
ret = PTR_ERR(dev->clk[0]);
354354
goto out_clk;
355355
}
356-
if (!IS_ERR(dev->clk[0]))
357-
clk_prepare_enable(dev->clk[0]);
356+
clk_prepare_enable(dev->clk[0]);
358357
}
359358

360359

@@ -422,8 +421,6 @@ static void orion_mdio_remove(struct platform_device *pdev)
422421
mdiobus_unregister(bus);
423422

424423
for (i = 0; i < ARRAY_SIZE(dev->clk); i++) {
425-
if (IS_ERR(dev->clk[i]))
426-
break;
427424
clk_disable_unprepare(dev->clk[i]);
428425
clk_put(dev->clk[i]);
429426
}

0 commit comments

Comments
 (0)