Commit 69da3f2a authored by Stefan Agner's avatar Stefan Agner Committed by Marc Kleine-Budde

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: default avatarStefan Agner <stefan@agner.ch>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 25b401c1
...@@ -1086,8 +1086,8 @@ static int mcp251x_can_probe(struct spi_device *spi) ...@@ -1086,8 +1086,8 @@ static int mcp251x_can_probe(struct spi_device *spi)
if (ret) if (ret)
goto out_clk; goto out_clk;
priv->power = devm_regulator_get(&spi->dev, "vdd"); priv->power = devm_regulator_get_optional(&spi->dev, "vdd");
priv->transceiver = devm_regulator_get(&spi->dev, "xceiver"); priv->transceiver = devm_regulator_get_optional(&spi->dev, "xceiver");
if ((PTR_ERR(priv->power) == -EPROBE_DEFER) || if ((PTR_ERR(priv->power) == -EPROBE_DEFER) ||
(PTR_ERR(priv->transceiver) == -EPROBE_DEFER)) { (PTR_ERR(priv->transceiver) == -EPROBE_DEFER)) {
ret = -EPROBE_DEFER; ret = -EPROBE_DEFER;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment