]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
leds: leds-gpio: Fix return value check in create_gpio_led()
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Sat, 6 Feb 2016 14:37:33 +0000 (22:37 +0800)
committerJacek Anaszewski <j.anaszewski@samsung.com>
Mon, 8 Feb 2016 08:05:02 +0000 (09:05 +0100)
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 <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
drivers/leds/leds-gpio.c

index 7bc53280dbfdd91d0d2efa51bb63986a6bbf336b..5883dede34238862c8cbc8871240aa93f93ab780 100644 (file)
@@ -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;