Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

backlight: pwm-backlight: Use devm_gpiod_get_optional()

Make use of the new devm_gpiod_get_optional() to simplify the probe
code.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Alexandre Courbot and committed by
Lee Jones
ff9c5422 1e3b0970

+2 -5
+2 -5
drivers/video/backlight/pwm_bl.c
··· 239 239 pb->dev = &pdev->dev; 240 240 pb->enabled = false; 241 241 242 - pb->enable_gpio = devm_gpiod_get(&pdev->dev, "enable"); 242 + pb->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable"); 243 243 if (IS_ERR(pb->enable_gpio)) { 244 244 ret = PTR_ERR(pb->enable_gpio); 245 - if (ret == -ENOENT) 246 - pb->enable_gpio = NULL; 247 - else 248 - goto err_alloc; 245 + goto err_alloc; 249 246 } 250 247 251 248 /*