lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 27 Aug 2020 12:13:43 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Krzysztof Kozlowski <krzk@...nel.org>
Cc:     Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Hans de Goede <hdegoede@...hat.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Bastien Nocera <hadess@...ess.net>,
        Sangwon Jee <jeesw@...fas.com>,
        Eugen Hristev <eugen.hristev@...rochip.com>,
        "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        linux-input <linux-input@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Platform Driver <platform-driver-x86@...r.kernel.org>
Subject: Re: [PATCH 16/24] Input: goodix - Simplify with dev_err_probe()

On Wed, Aug 26, 2020 at 9:19 PM Krzysztof Kozlowski <krzk@...nel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>

> Signed-off-by: Krzysztof Kozlowski <krzk@...nel.org>
> ---
>  drivers/input/touchscreen/goodix.c | 40 ++++++++----------------------
>  1 file changed, 11 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
> index 02c75ea385e0..48c4c3d297fe 100644
> --- a/drivers/input/touchscreen/goodix.c
> +++ b/drivers/input/touchscreen/goodix.c
> @@ -864,7 +864,6 @@ static int goodix_add_acpi_gpio_mappings(struct goodix_ts_data *ts)
>   */
>  static int goodix_get_gpio_config(struct goodix_ts_data *ts)
>  {
> -       int error;
>         struct device *dev;
>         struct gpio_desc *gpiod;
>         bool added_acpi_mappings = false;
> @@ -874,33 +873,20 @@ static int goodix_get_gpio_config(struct goodix_ts_data *ts)
>         dev = &ts->client->dev;
>
>         ts->avdd28 = devm_regulator_get(dev, "AVDD28");
> -       if (IS_ERR(ts->avdd28)) {
> -               error = PTR_ERR(ts->avdd28);
> -               if (error != -EPROBE_DEFER)
> -                       dev_err(dev,
> -                               "Failed to get AVDD28 regulator: %d\n", error);
> -               return error;
> -       }
> +       if (IS_ERR(ts->avdd28))
> +               return dev_err_probe(dev, PTR_ERR(ts->avdd28), "Failed to get AVDD28 regulator\n");
>
>         ts->vddio = devm_regulator_get(dev, "VDDIO");
> -       if (IS_ERR(ts->vddio)) {
> -               error = PTR_ERR(ts->vddio);
> -               if (error != -EPROBE_DEFER)
> -                       dev_err(dev,
> -                               "Failed to get VDDIO regulator: %d\n", error);
> -               return error;
> -       }
> +       if (IS_ERR(ts->vddio))
> +               return dev_err_probe(dev, PTR_ERR(ts->vddio), "Failed to get VDDIO regulator\n");
>
>  retry_get_irq_gpio:
>         /* Get the interrupt GPIO pin number */
>         gpiod = devm_gpiod_get_optional(dev, GOODIX_GPIO_INT_NAME, GPIOD_IN);
> -       if (IS_ERR(gpiod)) {
> -               error = PTR_ERR(gpiod);
> -               if (error != -EPROBE_DEFER)
> -                       dev_dbg(dev, "Failed to get %s GPIO: %d\n",
> -                               GOODIX_GPIO_INT_NAME, error);
> -               return error;
> -       }
> +       if (IS_ERR(gpiod))
> +               return dev_err_probe(dev, PTR_ERR(gpiod), "Failed to get %s GPIO\n",
> +                                    GOODIX_GPIO_INT_NAME);
> +
>         if (!gpiod && has_acpi_companion(dev) && !added_acpi_mappings) {
>                 added_acpi_mappings = true;
>                 if (goodix_add_acpi_gpio_mappings(ts) == 0)
> @@ -911,13 +897,9 @@ static int goodix_get_gpio_config(struct goodix_ts_data *ts)
>
>         /* Get the reset line GPIO pin number */
>         gpiod = devm_gpiod_get_optional(dev, GOODIX_GPIO_RST_NAME, GPIOD_IN);
> -       if (IS_ERR(gpiod)) {
> -               error = PTR_ERR(gpiod);
> -               if (error != -EPROBE_DEFER)
> -                       dev_dbg(dev, "Failed to get %s GPIO: %d\n",
> -                               GOODIX_GPIO_RST_NAME, error);
> -               return error;
> -       }
> +       if (IS_ERR(gpiod))
> +               return dev_err_probe(dev, PTR_ERR(gpiod), "Failed to get %s GPIO\n",
> +                                    GOODIX_GPIO_RST_NAME);
>
>         ts->gpiod_rst = gpiod;
>
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ