From: Wei Yongjun Date: Sat, 6 Feb 2016 14:37:33 +0000 (+0800) Subject: leds: leds-gpio: Fix return value check in create_gpio_led() X-Git-Tag: v4.6-rc1~143^2~15 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=2d88a331e48095cf60ad9bdf3177bd401bf99727;p=karo-tx-linux.git leds: leds-gpio: Fix return value check in create_gpio_led() In case of error, the function gpio_to_desc() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Signed-off-by: Wei Yongjun Signed-off-by: Jacek Anaszewski --- diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index 7bc53280dbfd..5883dede3423 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c @@ -104,8 +104,8 @@ static int create_gpio_led(const struct gpio_led *template, return ret; led_dat->gpiod = gpio_to_desc(template->gpio); - if (IS_ERR(led_dat->gpiod)) - return PTR_ERR(led_dat->gpiod); + if (!led_dat->gpiod) + return -EINVAL; } led_dat->cdev.name = template->name;