Re: [PATCH v2 17/20] extcon: intel-cht-wc: Support devs with Micro-B / USB-2 only Type-C connectors

From: Andy Shevchenko
Date: Tue Nov 16 2021 - 06:34:52 EST


On Tue, Nov 16, 2021 at 1:28 PM Andy Shevchenko
<andy.shevchenko@xxxxxxxxx> wrote:
> On Sun, Nov 14, 2021 at 7:04 PM Hans de Goede <hdegoede@xxxxxxxxxx> 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