summaryrefslogtreecommitdiffstats
path: root/drivers/net/can
diff options
context:
space:
mode:
authorStefan Agner <stefan@agner.ch>2015-05-18 18:33:28 +0200
committerMarc Kleine-Budde <mkl@pengutronix.de>2015-07-16 09:04:22 +0200
commit69da3f2ac528642acbd06ed14564ac1b9a918394 (patch)
treeb8d502e46fa867e830901f6f01cdadaaf0e6c05a /drivers/net/can
parentcan: mcp251x: fix resume when device is down (diff)
downloadlinux-69da3f2ac528642acbd06ed14564ac1b9a918394.tar.xz
linux-69da3f2ac528642acbd06ed14564ac1b9a918394.zip
can: mcp251x: get regulators optionally
The regulators power and transceiver are optional. If those are not present, the pointer (or error pointer) is correctly handled by the driver, hence we can use devm_regulator_get_optional safely, which avoids regulators getting created. Signed-off-by: Stefan Agner <stefan@agner.ch> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can')
-rw-r--r--drivers/net/can/spi/mcp251x.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c
index 3b2f34e6ba9b..b7e83c212023 100644
--- a/drivers/net/can/spi/mcp251x.c
+++ b/drivers/net/can/spi/mcp251x.c
@@ -1086,8 +1086,8 @@ static int mcp251x_can_probe(struct spi_device *spi)
if (ret)
goto out_clk;
- priv->power = devm_regulator_get(&spi->dev, "vdd");
- priv->transceiver = devm_regulator_get(&spi->dev, "xceiver");
+ priv->power = devm_regulator_get_optional(&spi->dev, "vdd");
+ priv->transceiver = devm_regulator_get_optional(&spi->dev, "xceiver");
if ((PTR_ERR(priv->power) == -EPROBE_DEFER) ||
(PTR_ERR(priv->transceiver) == -EPROBE_DEFER)) {
ret = -EPROBE_DEFER;