lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHp75Vc4VdfNeaLH_7MOGLsJLnbyYB+DnSpsyoDx2GDFV2N5Dg@mail.gmail.com>
Date:   Thu, 10 Sep 2020 14:23:10 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Krzysztof Kozlowski <krzk@...nel.org>
Cc:     Peter Rosin <peda@...ntia.se>, Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Peter Meerwald-Stadler <pmeerw@...erw.net>,
        Michael Hennerich <Michael.Hennerich@...log.com>,
        Marek Vasut <marek.vasut@...il.com>,
        Tomasz Duszynski <tomasz.duszynski@...akon.com>,
        "linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "linux-samsung-soc@...r.kernel.org" 
        <linux-samsung-soc@...r.kernel.org>,
        "linux-amlogic@...ts.infradead.org" 
        <linux-amlogic@...ts.infradead.org>,
        "linux-stm32@...md-mailman.stormreply.com" 
        <linux-stm32@...md-mailman.stormreply.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH v3 08/18] iio: adc: stm32: Simplify with dev_err_probe()

On Thu, Sep 10, 2020 at 9:59 AM Krzysztof Kozlowski <krzk@...nel.org> wrote:
> On Thu, 10 Sep 2020 at 08:52, Andy Shevchenko <andy.shevchenko@...il.com> wrote:
> > On Thursday, September 10, 2020, Peter Rosin <peda@...ntia.se> wrote:
> >> On 2020-09-09 21:57, Krzysztof Kozlowski wrote:
> >> > On Wed, 9 Sep 2020 at 20:36, Jonathan Cameron <jic23@...nel.org> wrote:
> >> >> On Sat, 29 Aug 2020 08:47:16 +0200
> >> >> Krzysztof Kozlowski <krzk@...nel.org> wrote:

...

> >> >>> @@ -596,12 +594,9 @@ static int stm32_adc_core_switches_probe(struct device *dev,
> >> >>>               priv->booster = devm_regulator_get_optional(dev, "booster");
> >> >>>               if (IS_ERR(priv->booster)) {
> >> >>>                       ret = PTR_ERR(priv->booster);
> >> >>> -                     if (ret != -ENODEV) {
> >> >>> -                             if (ret != -EPROBE_DEFER)
> >> >>> -                                     dev_err(dev, "can't get booster %d\n",
> >> >>> -                                             ret);
> >> >>> -                             return ret;
> >> >>> -                     }
> >> >>> +                     if (ret != -ENODEV)
> >> >>> +                             dev_err_probe(dev, ret, "can't get booster\n");
> >> >>
> >> >> This tripped a warning and got the patch dropped because we no longer
> >> >> return on error.
> >>
> >> As Jonathan already said, we no longer return in this hunk. I.e., you have
> >> clobbered the error path.
> >
> >
> > Exactly my point why I proposed _must_check in the first place.
>
> That was not exactly that point as you did not mention possible errors
> but only "miss the opportunity to optimize". Optimization is different
> things than a mistake.

Yes, and that's what happened here. You missed optimization which led
to an error.

And this is a good showcase to see how dev_err_probe() may be misused
because of overlooking subtle details.
Perhaps we can do

static inline __must_check dev_err_probe_ret(...)
{
  return dev_err_probe(...);
}

(or other way around, introduce dev_err_probe_noret(), yes, name sucks)

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ