Input: cy8ctma140 - simplify with dev_err_probe()
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Sun, 25 Jun 2023 16:28:02 +0000 (18:28 +0200)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 7 Jul 2023 23:54:28 +0000 (16:54 -0700)
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>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230625162817.100397-10-krzysztof.kozlowski@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/touchscreen/cy8ctma140.c

index 967ecde23e83ff53cc6c17c40baddec88b7be138..ea3895167b82e529fc0d7f6d05e989f7022f6ef3 100644 (file)
@@ -258,12 +258,8 @@ static int cy8ctma140_probe(struct i2c_client *client)
        ts->regulators[1].supply = "vdd";
        error = devm_regulator_bulk_get(dev, ARRAY_SIZE(ts->regulators),
                                      ts->regulators);
-       if (error) {
-               if (error != -EPROBE_DEFER)
-                       dev_err(dev, "Failed to get regulators %d\n",
-                               error);
-               return error;
-       }
+       if (error)
+               return dev_err_probe(dev, error, "Failed to get regulators\n");
 
        error = cy8ctma140_power_up(ts);
        if (error)