lkml.org 
[lkml]   [2020]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 04/24] Input: gpio-vibra - Simplify with dev_err_probe()
    On Thu, Aug 27, 2020 at 12:03:52PM +0300, Andy Shevchenko wrote:
    > On Wed, Aug 26, 2020 at 9:20 PM Krzysztof Kozlowski <krzk@kernel.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?

    Good point.

    Best regards,
    Krzysztof

    \
     
     \ /
      Last update: 2020-08-27 20:41    [W:3.282 / U:0.144 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site