diff options
author | Alexander Shiyan <shc_work@mail.ru> | 2014-03-14 04:46:20 -0400 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2014-03-17 04:20:17 -0400 |
commit | 76aeec83e448478838eec868066dda33049d1288 (patch) | |
tree | 2210e0cf43d823054b1104b71a9db4058004619b /drivers | |
parent | 3e66d0138c05d9792f458b96581afdb314bc66d6 (diff) |
can: mcp251x: Fix regulators operation without CONFIG_REGULATOR
If CONFIG_REGULATOR is not set, devm_regulator_get() returns NULL,
so use IS_ERR_OR_NULL() macro for checks.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/can/mcp251x.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c index a8b74f8da03d..28c11f815245 100644 --- a/drivers/net/can/mcp251x.c +++ b/drivers/net/can/mcp251x.c | |||
@@ -672,7 +672,7 @@ static int mcp251x_hw_probe(struct spi_device *spi) | |||
672 | 672 | ||
673 | static int mcp251x_power_enable(struct regulator *reg, int enable) | 673 | static int mcp251x_power_enable(struct regulator *reg, int enable) |
674 | { | 674 | { |
675 | if (IS_ERR(reg)) | 675 | if (IS_ERR_OR_NULL(reg)) |
676 | return 0; | 676 | return 0; |
677 | 677 | ||
678 | if (enable) | 678 | if (enable) |
@@ -1218,7 +1218,7 @@ static int __maybe_unused mcp251x_can_suspend(struct device *dev) | |||
1218 | priv->after_suspend = AFTER_SUSPEND_DOWN; | 1218 | priv->after_suspend = AFTER_SUSPEND_DOWN; |
1219 | } | 1219 | } |
1220 | 1220 | ||
1221 | if (!IS_ERR(priv->power)) { | 1221 | if (!IS_ERR_OR_NULL(priv->power)) { |
1222 | regulator_disable(priv->power); | 1222 | regulator_disable(priv->power); |
1223 | priv->after_suspend |= AFTER_SUSPEND_POWER; | 1223 | priv->after_suspend |= AFTER_SUSPEND_POWER; |
1224 | } | 1224 | } |