backlight: pwm-backlight: Use devm_gpiod_get_optional()
[firefly-linux-kernel-4.4.55.git] / drivers / video / backlight / pwm_bl.c
index c9c8496369b335805f9f1cb68bd25cfe8685ed0b..d7a3d13e72ec3900232c34ab35d121eadfff2683 100644 (file)
@@ -239,13 +239,10 @@ static int pwm_backlight_probe(struct platform_device *pdev)
        pb->dev = &pdev->dev;
        pb->enabled = false;
 
-       pb->enable_gpio = devm_gpiod_get(&pdev->dev, "enable");
+       pb->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable");
        if (IS_ERR(pb->enable_gpio)) {
                ret = PTR_ERR(pb->enable_gpio);
-               if (ret == -ENOENT)
-                       pb->enable_gpio = NULL;
-               else
-                       goto err_alloc;
+               goto err_alloc;
        }
 
        /*