Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -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;