[media] media: i2c/adp1653: fix check of devm_gpiod_get() error code
authorVladimir Zapolskiy <vz@mleia.com>
Mon, 7 Mar 2016 18:39:32 +0000 (15:39 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Fri, 6 May 2016 18:39:17 +0000 (15:39 -0300)
The devm_gpiod_get() function returns either a valid pointer to
struct gpio_desc or ERR_PTR() error value, check for NULL is bogus.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/i2c/adp1653.c

index fb7ed73..9e1731c 100644 (file)
@@ -466,9 +466,9 @@ static int adp1653_of_init(struct i2c_client *client,
        of_node_put(child);
 
        pd->enable_gpio = devm_gpiod_get(&client->dev, "enable", GPIOD_OUT_LOW);
-       if (!pd->enable_gpio) {
+       if (IS_ERR(pd->enable_gpio)) {
                dev_err(&client->dev, "Error getting GPIO\n");
-               return -EINVAL;
+               return PTR_ERR(pd->enable_gpio);
        }
 
        return 0;