Messages in this thread | | | From | Andy Shevchenko <> | Date | Tue, 16 Nov 2021 13:31:05 +0200 | Subject | Re: [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
| |