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>
This commit is contained in:
Wei Yongjun 2016-02-06 22:37:33 +08:00 committed by Jacek Anaszewski
parent c9eec908a1
commit 2d88a331e4
1 changed files with 2 additions and 2 deletions

View 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;