[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJKOXPdD0Qa1Fom4QYctjua4TfBa8CPaHd6PG5QViNweAr3GJQ@mail.gmail.com>
Date: Thu, 10 Sep 2020 10:36:39 +0200
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Cc: Andy Shevchenko <andy.shevchenko@...il.com>,
Lars-Peter Clausen <lars@...afoo.de>,
Tomasz Duszynski <tomasz.duszynski@...akon.com>,
Michael Hennerich <Michael.Hennerich@...log.com>,
"linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-stm32@...md-mailman.stormreply.com"
<linux-stm32@...md-mailman.stormreply.com>,
Marek Vasut <marek.vasut@...il.com>,
"linux-samsung-soc@...r.kernel.org"
<linux-samsung-soc@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
Peter Meerwald-Stadler <pmeerw@...erw.net>,
"linux-amlogic@...ts.infradead.org"
<linux-amlogic@...ts.infradead.org>, Peter Rosin <peda@...ntia.se>,
Jonathan Cameron <jic23@...nel.org>
Subject: Re: [PATCH v3 08/18] iio: adc: stm32: Simplify with dev_err_probe()
On Thu, 10 Sep 2020 at 10:13, Jonathan Cameron
<Jonathan.Cameron@...wei.com> wrote:
>
> On Thu, 10 Sep 2020 08:58:57 +0200
> 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:
> > >>
> > >> Hi!
> > >>
> > >> 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:
> > >> >>
> > >> >>> Common pattern of handling deferred probe can be simplified with
> > >> >>> dev_err_probe(). Less code and also it prints the error value.
> > >> >>>
> > >> >>> Signed-off-by: Krzysztof Kozlowski <krzk@...nel.org>
> > >> >>> Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>
> > >> >>>
> > >> >> I don't have the thread to hand, but this tripped a warning next
> > >> >> and the patch was dropped as a result. See below.
>
> oops. That is what I get for reading an email very quickly then looking
> at the code a few hours later. Still a problem here we need to fix
> unless I'm missing something.
>
> > >> >
> > >> > Thanks for letting me know. If you mean the warning caused by:
> > >> > https://lore.kernel.org/lkml/20200909073716.GA560912@kroah.com/
> > >> > then the driver-core patch was dropped, not the iio one:
> > >> > https://lore.kernel.org/linux-next/20200909074130.GB561485@kroah.com/T/#t
> > >> >
> > >> > So we are good here :)
> > >>
> > >> No, we are definitely not good. See below. That means "See below", and
> > >> not "Please take a guess at what is being talking about".
> > >
> > >
> > >
> > >>
> > >> >>> @@ -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.
>
> In this particular case we have introduced a bug. If the regulator returns
> an error other than -ENODEV we will carry on when really should error out.
> This includes deferred probe route in which it won't print a message but also won't
> actually defer.
Yes, I see, Peter pointed this out. The commit was actually not
dropped from next so I will send a fixup.
Best regards,
Krzysztof
Powered by blists - more mailing lists