lkml.org 
[lkml]   [2021]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2 17/20] extcon: intel-cht-wc: Support devs with Micro-B / USB-2 only Type-C connectors
On Tue, Nov 16, 2021 at 1:28 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Sun, Nov 14, 2021 at 7:04 PM Hans de Goede <hdegoede@redhat.com> wrote:

...

> > + ext->vbus_boost = devm_regulator_get_optional(ext->dev, "vbus");
> > + if (IS_ERR(ext->vbus_boost)) {
> > + ret = PTR_ERR(ext->vbus_boost);
> > + if (ret == -ENODEV)
> > + ret = -EPROBE_DEFER;
> > +
> > + return dev_err_probe(ext->dev, ret, "getting vbus regulator");
>
> Can be also written as
>
> if (PTR_ERR(ext->vbus_boost) == -ENODEV ||
> PTR_ERR(ext->vbus_boost) == -EPROBE_DEFER)
> return dev_err_probe(ext->dev, -EPROBE_DEFER, "getting vbus regulator");
>
> return PTR_ERR(ext->vbus_boost);

Oops, other way around, of course.

if (PTR_ERR(ext->vbus_boost) == -ENODEV ||
PTR_ERR(ext->vbus_boost) == -EPROBE_DEFER)
return -EPROBE_DEFER;

return dev_err_probe(ext->dev, PTR_ERR(ext->vbus_boost), "getting
vbus regulator");

> but up to you.
>
> > + }



--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2021-11-16 12:35    [W:0.054 / U:3.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site