leds: pwm: silently error out on EPROBE_DEFER
authorJerome Brunet <jbrunet@baylibre.com>
Thu, 6 Sep 2018 13:59:04 +0000 (15:59 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 May 2019 17:42:29 +0000 (19:42 +0200)
[ Upstream commit 9aec30371fb095a0c9415f3f0146ae269c3713d8 ]

When probing, if we fail to get the pwm due to probe deferal, we shouldn't
print an error message. Just be silent in this case.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
drivers/leds/leds-pwm.c

index 8d456dc6c5bfecb68daab1b753754d062e862193..83f9bbe57e02b5641615cd0e4f7c291ad6d9d2d3 100644 (file)
@@ -101,8 +101,9 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv,
                led_data->pwm = devm_pwm_get(dev, led->name);
        if (IS_ERR(led_data->pwm)) {
                ret = PTR_ERR(led_data->pwm);
-               dev_err(dev, "unable to request PWM for %s: %d\n",
-                       led->name, ret);
+               if (ret != -EPROBE_DEFER)
+                       dev_err(dev, "unable to request PWM for %s: %d\n",
+                               led->name, ret);
                return ret;
        }