aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Kleine-Budde2020-09-22 16:44:16 +0200
committerMarc Kleine-Budde2020-09-22 16:49:54 +0200
commit3d60f33a7a7afa7ba02b96ecc835c3450bf234b1 (patch)
tree15c06134c3f47d3b066db42b50e383284bfc752b
parentab60523a76a4d40051ece11b23b099e273f9a485 (diff)
can: flexcan: flexcan_probe(): make regulator xceiver optional
As the transcevier regulator is optional, this patch switches from devm_regulator_get() to devm_regulator_get_optional(). This gets rid of "using dummy regulator" warning message from the regulator core, if no regulator is available. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Link: https://lore.kernel.org/r/20200922144429.2613631-8-mkl@pengutronix.de
-rw-r--r--drivers/net/can/flexcan.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 06cddc468739..52b53ff223f4 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -1579,11 +1579,13 @@ static int flexcan_probe(struct platform_device *pdev)
u8 clk_src = 1;
u32 clock_freq = 0;
- reg_xceiver = devm_regulator_get(&pdev->dev, "xceiver");
+ reg_xceiver = devm_regulator_get_optional(&pdev->dev, "xceiver");
if (PTR_ERR(reg_xceiver) == -EPROBE_DEFER)
return -EPROBE_DEFER;
- else if (IS_ERR(reg_xceiver))
+ else if (PTR_ERR(reg_xceiver) == -ENODEV)
reg_xceiver = NULL;
+ else if (IS_ERR(reg_xceiver))
+ return PTR_ERR(reg_xceiver);
if (pdev->dev.of_node) {
of_property_read_u32(pdev->dev.of_node,