Skip to content

Commit dadc5b8

Browse files
AnnYugawakuba-moo
authored andcommitted
net: dsa: fix value check in bcm_sf2_sw_probe()
in bcm_sf2_sw_probe(), check the return value of clk_prepare_enable() and return the error code if clk_prepare_enable() returns an unexpected value. Fixes: e9ec5c3 ("net: dsa: bcm_sf2: request and handle clocks") Signed-off-by: Yuanjun Gong <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 4d50e50 commit dadc5b8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/net/dsa/bcm_sf2.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,15 +1436,19 @@ static int bcm_sf2_sw_probe(struct platform_device *pdev)
14361436
if (IS_ERR(priv->clk))
14371437
return PTR_ERR(priv->clk);
14381438

1439-
clk_prepare_enable(priv->clk);
1439+
ret = clk_prepare_enable(priv->clk);
1440+
if (ret)
1441+
return ret;
14401442

14411443
priv->clk_mdiv = devm_clk_get_optional(&pdev->dev, "sw_switch_mdiv");
14421444
if (IS_ERR(priv->clk_mdiv)) {
14431445
ret = PTR_ERR(priv->clk_mdiv);
14441446
goto out_clk;
14451447
}
14461448

1447-
clk_prepare_enable(priv->clk_mdiv);
1449+
ret = clk_prepare_enable(priv->clk_mdiv);
1450+
if (ret)
1451+
goto out_clk;
14481452

14491453
ret = bcm_sf2_sw_rst(priv);
14501454
if (ret) {

0 commit comments

Comments
 (0)