提交 69da3f2a 编写于 作者: S Stefan Agner 提交者: 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: NStefan Agner <stefan@agner.ch>
Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册