mirror of
https://github.com/torvalds/linux.git
synced 2024-11-17 09:31:50 +00:00
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>
This commit is contained in:
parent
25b401c181
commit
69da3f2ac5
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user