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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VdygxySau_Ma5YqARgR92BNM+AK3yn2rThYxFEmzdYSLg@mail.gmail.com>
Date:   Thu, 27 Aug 2020 12:20:00 +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 24/24] Input: sx8643 - Simplify with dev_err_probe()

On Wed, Aug 26, 2020 at 9:21 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>

Just in case if you want to save more LOCs, you may in some drivers
introduce temporary variable for device pointer, like

struct device *dev = &client->dev;

> Signed-off-by: Krzysztof Kozlowski <krzk@...nel.org>
> ---
>  drivers/input/touchscreen/sx8654.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/input/touchscreen/sx8654.c b/drivers/input/touchscreen/sx8654.c
> index de85e57b2486..d2ed9be64c3a 100644
> --- a/drivers/input/touchscreen/sx8654.c
> +++ b/drivers/input/touchscreen/sx8654.c
> @@ -323,13 +323,9 @@ static int sx8654_probe(struct i2c_client *client,
>
>         sx8654->gpio_reset = devm_gpiod_get_optional(&client->dev, "reset",
>                                                      GPIOD_OUT_HIGH);
> -       if (IS_ERR(sx8654->gpio_reset)) {
> -               error = PTR_ERR(sx8654->gpio_reset);
> -               if (error != -EPROBE_DEFER)
> -                       dev_err(&client->dev, "unable to get reset-gpio: %d\n",
> -                               error);
> -               return error;
> -       }
> +       if (IS_ERR(sx8654->gpio_reset))
> +               return dev_err_probe(&client->dev, PTR_ERR(sx8654->gpio_reset),
> +                                    "unable to get reset-gpio\n");
>         dev_dbg(&client->dev, "got GPIO reset pin\n");
>
>         sx8654->data = device_get_match_data(&client->dev);
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ