pps: clients: gpio: Use dev_err_probe() to avoid log noise
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 18 Mar 2021 13:03:16 +0000 (15:03 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Mar 2021 07:26:31 +0000 (08:26 +0100)
When GPIO APIs return -EPROBE_DEFER there is no need to print the message,
especially taking into consideration that it may repeat several times.
Use dev_err_probe() to avoid log noise in such cases.

Acked-by: Rodolfo Giometti <giometti@enneenne.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210318130321.24227-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/pps/clients/pps-gpio.c

index f89c31aa66f1d536ab524c6aa50d25402694658c..78c9680e80633d860f9a417bc8b36ffc1ad009fb 100644 (file)
@@ -110,19 +110,16 @@ static int pps_gpio_setup(struct platform_device *pdev)
        data->gpio_pin = devm_gpiod_get(&pdev->dev,
                NULL,   /* request "gpios" */
                GPIOD_IN);
-       if (IS_ERR(data->gpio_pin)) {
-               dev_err(&pdev->dev,
-                       "failed to request PPS GPIO\n");
-               return PTR_ERR(data->gpio_pin);
-       }
+       if (IS_ERR(data->gpio_pin))
+               return dev_err_probe(&pdev->dev, PTR_ERR(data->gpio_pin),
+                                    "failed to request PPS GPIO\n");
 
        data->echo_pin = devm_gpiod_get_optional(&pdev->dev,
                        "echo",
                        GPIOD_OUT_LOW);
-       if (IS_ERR(data->echo_pin)) {
-               dev_err(&pdev->dev, "failed to request ECHO GPIO\n");
-               return PTR_ERR(data->echo_pin);
-       }
+       if (IS_ERR(data->echo_pin))
+               return dev_err_probe(&pdev->dev, PTR_ERR(data->echo_pin),
+                                    "failed to request ECHO GPIO\n");
 
        if (data->echo_pin) {
                ret = of_property_read_u32(np,