Skip to content

Commit 2bca075

Browse files
Brett Werlingsmb49
authored andcommitted
can: tcan4x5x: fix power regulator retrieval during probe
BugLink: https://bugs.launchpad.net/bugs/2120812 commit db22720545207f734aaa9d9f71637bfc8b0155e0 upstream. 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Noah Wager <[email protected]> Signed-off-by: Stefan Bader <[email protected]>
1 parent a28e6b8 commit 2bca075

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)