diff options
author | Krzysztof Kozlowski <krzk@kernel.org> | 2020-08-26 17:50:12 +0300 |
---|---|---|
committer | Pavel Machek <pavel@ucw.cz> | 2020-09-09 12:20:09 +0300 |
commit | 4582e783a2f481a813aa61178d77b2a5cb8f1d9e (patch) | |
tree | 3f5a3f889d8f4e713e81efa8c5de3bc8b73302b5 /drivers/leds/leds-sgm3140.c | |
parent | 7e8da60596b26c40483375f75297f45bd81d4096 (diff) | |
download | linux-4582e783a2f481a813aa61178d77b2a5cb8f1d9e.tar.xz |
leds: sgm3140: Simplify with dev_err_probe()
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Diffstat (limited to 'drivers/leds/leds-sgm3140.c')
-rw-r--r-- | drivers/leds/leds-sgm3140.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/drivers/leds/leds-sgm3140.c b/drivers/leds/leds-sgm3140.c index 28c8b31fa952..f4f831570f11 100644 --- a/drivers/leds/leds-sgm3140.c +++ b/drivers/leds/leds-sgm3140.c @@ -195,30 +195,21 @@ static int sgm3140_probe(struct platform_device *pdev) priv->flash_gpio = devm_gpiod_get(&pdev->dev, "flash", GPIOD_OUT_LOW); ret = PTR_ERR_OR_ZERO(priv->flash_gpio); - if (ret) { - if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, - "Failed to request flash gpio: %d\n", ret); - return ret; - } + if (ret) + return dev_err_probe(&pdev->dev, ret, + "Failed to request flash gpio\n"); priv->enable_gpio = devm_gpiod_get(&pdev->dev, "enable", GPIOD_OUT_LOW); ret = PTR_ERR_OR_ZERO(priv->enable_gpio); - if (ret) { - if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, - "Failed to request enable gpio: %d\n", ret); - return ret; - } + if (ret) + return dev_err_probe(&pdev->dev, ret, + "Failed to request enable gpio\n"); priv->vin_regulator = devm_regulator_get(&pdev->dev, "vin"); ret = PTR_ERR_OR_ZERO(priv->vin_regulator); - if (ret) { - if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, - "Failed to request regulator: %d\n", ret); - return ret; - } + if (ret) + return dev_err_probe(&pdev->dev, ret, + "Failed to request regulator\n"); child_node = fwnode_get_next_available_child_node(pdev->dev.fwnode, NULL); |