can: mcp251x: Fix regulators operation without CONFIG_REGULATOR
authorAlexander Shiyan <shc_work@mail.ru>
Fri, 14 Mar 2014 08:46:20 +0000 (12:46 +0400)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Mon, 17 Mar 2014 08:20:17 +0000 (09:20 +0100)
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>
drivers/net/can/mcp251x.c

index a8b74f8da03d5c716d4870610802e20c604fef5c..28c11f81524524fe521eb0c24177fffa76323885 100644 (file)
@@ -672,7 +672,7 @@ static int mcp251x_hw_probe(struct spi_device *spi)
 
 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 @@ static int __maybe_unused mcp251x_can_suspend(struct device *dev)
                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;
        }