Commit 0c4da5d2 authored by Wei Yongjun's avatar Wei Yongjun Committed by Greg Kroah-Hartman

leds: leds-gpio: Fix return value check in create_gpio_led()

commit 2d88a331 upstream.

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: default avatarWei Yongjun <>
Signed-off-by: default avatarJacek Anaszewski <>
Signed-off-by: default avatarKrzysztof Kozlowski <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent 5e946ed3
......@@ -118,8 +118,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-> = template->name;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment