mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 14:04:54 +02:00
leds: leds-gpio: Fix return value check in create_gpio_led()
commit 2d88a331e4 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: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
5e946ed3c5
commit
0c4da5d2b0
|
|
@ -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->cdev.name = template->name;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user