Skip to content

Commit ac88c53

Browse files
pcercueidavem330
authored andcommitted
net: davicom: Fix regulator not turned off on failed probe
When the probe fails or requests to be defered, we must disable the regulator that was previously enabled. Fixes: 7994fe5 ("dm9000: Add regulator and reset support to dm9000") Signed-off-by: Paul Cercueil <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 03cbb87 commit ac88c53

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

drivers/net/ethernet/davicom/dm9000.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,7 +1449,7 @@ dm9000_probe(struct platform_device *pdev)
14491449
if (ret) {
14501450
dev_err(dev, "failed to request reset gpio %d: %d\n",
14511451
reset_gpios, ret);
1452-
return -ENODEV;
1452+
goto out_regulator_disable;
14531453
}
14541454

14551455
/* According to manual PWRST# Low Period Min 1ms */
@@ -1461,8 +1461,10 @@ dm9000_probe(struct platform_device *pdev)
14611461

14621462
if (!pdata) {
14631463
pdata = dm9000_parse_dt(&pdev->dev);
1464-
if (IS_ERR(pdata))
1465-
return PTR_ERR(pdata);
1464+
if (IS_ERR(pdata)) {
1465+
ret = PTR_ERR(pdata);
1466+
goto out_regulator_disable;
1467+
}
14661468
}
14671469

14681470
/* Init network device */
@@ -1703,6 +1705,10 @@ dm9000_probe(struct platform_device *pdev)
17031705
dm9000_release_board(pdev, db);
17041706
free_netdev(ndev);
17051707

1708+
out_regulator_disable:
1709+
if (!IS_ERR(power))
1710+
regulator_disable(power);
1711+
17061712
return ret;
17071713
}
17081714

0 commit comments

Comments
 (0)