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 <[email protected]>
Signed-off-by: Marc Kleine-Budde <[email protected]>
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index a8b74f8..28c11f8 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -672,7 +672,7 @@
static int mcp251x_power_enable(struct regulator *reg, int enable)
{
- if (IS_ERR(reg))
+ if (IS_ERR_OR_NULL(reg))
return 0;
if (enable)
@@ -1218,7 +1218,7 @@
priv->after_suspend = AFTER_SUSPEND_DOWN;
}
- if (!IS_ERR(priv->power)) {
+ if (!IS_ERR_OR_NULL(priv->power)) {
regulator_disable(priv->power);
priv->after_suspend |= AFTER_SUSPEND_POWER;
}