Skip to content

Commit db22720

Browse files
Brett Werlingmarckleinebudde
authored andcommitted
can: tcan4x5x: fix power regulator retrieval during probe
Fixes the power regulator retrieval in tcan4x5x_can_probe() by ensuring the regulator pointer is not set to NULL in the successful return from devm_regulator_get_optional(). Fixes: 3814ca3 ("can: tcan4x5x: tcan4x5x_can_probe(): turn on the power before parsing the config") Signed-off-by: Brett Werling <[email protected]> Link: https://patch.msgid.link/[email protected] Cc: [email protected] Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 7b4ac12 commit db22720

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/net/can/m_can/tcan4x5x-core.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,10 +411,11 @@ static int tcan4x5x_can_probe(struct spi_device *spi)
411411
priv = cdev_to_priv(mcan_class);
412412

413413
priv->power = devm_regulator_get_optional(&spi->dev, "vsup");
414-
if (PTR_ERR(priv->power) == -EPROBE_DEFER) {
415-
ret = -EPROBE_DEFER;
416-
goto out_m_can_class_free_dev;
417-
} else {
414+
if (IS_ERR(priv->power)) {
415+
if (PTR_ERR(priv->power) == -EPROBE_DEFER) {
416+
ret = -EPROBE_DEFER;
417+
goto out_m_can_class_free_dev;
418+
}
418419
priv->power = NULL;
419420
}
420421

0 commit comments

Comments
 (0)