summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/micrel
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@codeaurora.org>2014-05-23 12:57:18 -0700
committerDavid S. Miller <davem@davemloft.net>2014-05-24 14:03:21 -0400
commitc78dbad8c441af4815cd660587470b78552ecfd8 (patch)
tree4df62528a8705d4ffa7309b76eabc79009969418 /drivers/net/ethernet/micrel
parent481300ccf3ef5a79bb7ba59f77c96035134606d9 (diff)
downloadblackbird-op-linux-c78dbad8c441af4815cd660587470b78552ecfd8.tar.gz
blackbird-op-linux-c78dbad8c441af4815cd660587470b78552ecfd8.zip
net: ks8851: Use devm_regulator_get_optional()
This simplifies error paths and removes the need to regulator_put(). Cc: Nishanth Menon <nm@ti.com> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/micrel')
-rw-r--r--drivers/net/ethernet/micrel/ks8851.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c
index 13767eb36a48..f2bfc708880c 100644
--- a/drivers/net/ethernet/micrel/ks8851.c
+++ b/drivers/net/ethernet/micrel/ks8851.c
@@ -1417,7 +1417,7 @@ static int ks8851_probe(struct spi_device *spi)
ks->spidev = spi;
ks->tx_space = 6144;
- ks->vdd_reg = regulator_get_optional(&spi->dev, "vdd");
+ ks->vdd_reg = devm_regulator_get_optional(&spi->dev, "vdd");
if (IS_ERR(ks->vdd_reg)) {
ret = PTR_ERR(ks->vdd_reg);
if (ret == -EPROBE_DEFER)
@@ -1427,7 +1427,7 @@ static int ks8851_probe(struct spi_device *spi)
if (ret) {
dev_err(&spi->dev, "regulator enable fail: %d\n",
ret);
- goto err_reg_en;
+ goto err_reg;
}
}
@@ -1530,9 +1530,6 @@ err_irq:
err_id:
if (!IS_ERR(ks->vdd_reg))
regulator_disable(ks->vdd_reg);
-err_reg_en:
- if (!IS_ERR(ks->vdd_reg))
- regulator_put(ks->vdd_reg);
err_reg:
free_netdev(ndev);
return ret;
@@ -1547,10 +1544,8 @@ static int ks8851_remove(struct spi_device *spi)
unregister_netdev(priv->netdev);
free_irq(spi->irq, priv);
- if (!IS_ERR(priv->vdd_reg)) {
+ if (!IS_ERR(priv->vdd_reg))
regulator_disable(priv->vdd_reg);
- regulator_put(priv->vdd_reg);
- }
free_netdev(priv->netdev);
return 0;
OpenPOWER on IntegriCloud