[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vey_w7m4TZM9+=df-FMO6YW5DiSMQsupZsMb92Awg_x1Q@mail.gmail.com>
Date: Thu, 27 Aug 2020 12:03:52 +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 04/24] Input: gpio-vibra - Simplify with dev_err_probe()
On Wed, Aug 26, 2020 at 9:20 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.
> 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 (err)
> + return dev_err_probe(&pdev->dev, err, "Failed to request regulator\n");
Can it be rather
if (IS_ERR())
return dev_err_probe(dev, PTR_ERR());
w/o err be involved?
> 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 (err)
> + return dev_err_probe(&pdev->dev, err, "Failed to request main gpio\n");
Ditto.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists