Message ID | 1457375972-9923-1-git-send-email-vz@mleia.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Vladimir, On Mon, Mar 07, 2016 at 08:39:32PM +0200, Vladimir Zapolskiy wrote: > 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> Thanks! Applied to my fixes branch.
diff --git a/drivers/media/i2c/adp1653.c b/drivers/media/i2c/adp1653.c index fb7ed73..9e1731c 100644 --- a/drivers/media/i2c/adp1653.c +++ b/drivers/media/i2c/adp1653.c @@ -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;
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> --- drivers/media/i2c/adp1653.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)