提交 76aeec83 编写于 作者: A Alexander Shiyan 提交者: Marc Kleine-Budde

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: NAlexander Shiyan <shc_work@mail.ru>
Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
上级 3e66d013
...@@ -672,7 +672,7 @@ static int mcp251x_hw_probe(struct spi_device *spi) ...@@ -672,7 +672,7 @@ static int mcp251x_hw_probe(struct spi_device *spi)
static int mcp251x_power_enable(struct regulator *reg, int enable) static int mcp251x_power_enable(struct regulator *reg, int enable)
{ {
if (IS_ERR(reg)) if (IS_ERR_OR_NULL(reg))
return 0; return 0;
if (enable) if (enable)
...@@ -1218,7 +1218,7 @@ static int __maybe_unused mcp251x_can_suspend(struct device *dev) ...@@ -1218,7 +1218,7 @@ static int __maybe_unused mcp251x_can_suspend(struct device *dev)
priv->after_suspend = AFTER_SUSPEND_DOWN; priv->after_suspend = AFTER_SUSPEND_DOWN;
} }
if (!IS_ERR(priv->power)) { if (!IS_ERR_OR_NULL(priv->power)) {
regulator_disable(priv->power); regulator_disable(priv->power);
priv->after_suspend |= AFTER_SUSPEND_POWER; priv->after_suspend |= AFTER_SUSPEND_POWER;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册