Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alexander Shiyan and committed by
Marc Kleine-Budde
76aeec83 3e66d013

+2 -2
+2 -2
drivers/net/can/mcp251x.c
··· 672 672 673 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 676 return 0; 677 677 678 678 if (enable) ··· 1218 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 1222 regulator_disable(priv->power); 1223 1223 priv->after_suspend |= AFTER_SUSPEND_POWER; 1224 1224 }