aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-gpio.c
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2016-02-06 22:37:33 +0800
committerJacek Anaszewski <j.anaszewski@samsung.com>2016-03-14 09:22:20 +0100
commit2d88a331e48095cf60ad9bdf3177bd401bf99727 (patch)
tree76d06c4421982a56793a5edf97c021b9514243fc /drivers/leds/leds-gpio.c
parentleds: lp3944: improve wording and formatting in a comment (diff)
downloadlinux-dev-2d88a331e48095cf60ad9bdf3177bd401bf99727.tar.xz
linux-dev-2d88a331e48095cf60ad9bdf3177bd401bf99727.zip
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 <yongjun_wei@trendmicro.com.cn> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Diffstat (limited to 'drivers/leds/leds-gpio.c')
-rw-r--r--drivers/leds/leds-gpio.c4
1 files changed, 2 insertions, 2 deletions
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;