summaryrefslogtreecommitdiffstats
path: root/drivers/input/misc/gpio-vibra.c
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>2023-06-25 18:27:55 +0200
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2023-07-07 16:54:27 -0700
commitc4834f4ad7fdc9002e7d3424bd7aed7a63f070be (patch)
treeb50e74a96ed026cc81b00216289e4651660c7423 /drivers/input/misc/gpio-vibra.c
parentcaec3d4416a2fbd7399556ba366da4d8fc05d9f5 (diff)
downloadlinux-stable-c4834f4ad7fdc9002e7d3424bd7aed7a63f070be.tar.gz
linux-stable-c4834f4ad7fdc9002e7d3424bd7aed7a63f070be.tar.bz2
linux-stable-c4834f4ad7fdc9002e7d3424bd7aed7a63f070be.zip
Input: gpio-vibra - 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 <krzysztof.kozlowski@linaro.org> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230625162817.100397-3-krzysztof.kozlowski@linaro.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/misc/gpio-vibra.c')
-rw-r--r--drivers/input/misc/gpio-vibra.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/input/misc/gpio-vibra.c b/drivers/input/misc/gpio-vibra.c
index 134a1309ba92..c1c3ba5960dd 100644
--- a/drivers/input/misc/gpio-vibra.c
+++ b/drivers/input/misc/gpio-vibra.c
@@ -113,22 +113,14 @@ static int gpio_vibrator_probe(struct platform_device *pdev)
return -ENOMEM;
vibrator->vcc = devm_regulator_get(&pdev->dev, "vcc");
- err = PTR_ERR_OR_ZERO(vibrator->vcc);
- if (err) {
- if (err != -EPROBE_DEFER)
- dev_err(&pdev->dev, "Failed to request regulator: %d\n",
- err);
- return err;
- }
+ if (IS_ERR(vibrator->vcc))
+ return dev_err_probe(&pdev->dev, PTR_ERR(vibrator->vcc),
+ "Failed to request regulator\n");
vibrator->gpio = devm_gpiod_get(&pdev->dev, "enable", GPIOD_OUT_LOW);
- err = PTR_ERR_OR_ZERO(vibrator->gpio);
- if (err) {
- if (err != -EPROBE_DEFER)
- dev_err(&pdev->dev, "Failed to request main gpio: %d\n",
- err);
- return err;
- }
+ if (IS_ERR(vibrator->gpio))
+ return dev_err_probe(&pdev->dev, PTR_ERR(vibrator->gpio),
+ "Failed to request main gpio\n");
INIT_WORK(&vibrator->play_work, gpio_vibrator_play_work);