[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vcq9MCOtJ3x=uhjcZVb2=i_wZRUeaXXbaCOdCb_-Z2TNQ@mail.gmail.com>
Date: Thu, 7 Aug 2025 23:20:30 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: David Lechner <dlechner@...libre.com>
Cc: Salah Triki <salah.triki@...il.com>, Lars-Peter Clausen <lars@...afoo.de>,
Michael Hennerich <Michael.Hennerich@...log.com>, Marcelo Schmitt <marcelo.schmitt@...log.com>,
Jonathan Cameron <jic23@...nel.org>, Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>, linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] iio: adc: ad4170-4: Use ERR_PTR() with %pe to improve
error logging
On Thu, Aug 7, 2025 at 11:14 PM David Lechner <dlechner@...libre.com> wrote:
> On 8/7/25 4:02 PM, Andy Shevchenko wrote:
> > On Thu, Aug 7, 2025 at 11:01 PM Andy Shevchenko
> > <andy.shevchenko@...il.com> wrote:
> >> On Thu, Aug 7, 2025 at 6:03 PM David Lechner <dlechner@...libre.com> wrote:
> >>> On 8/7/25 3:05 AM, Salah Triki wrote:
...
> >>>> ret = __ad4170_read_sample(indio_dev, chan, val);
> >>>> if (ret) {
> >>>> - dev_err(dev, "failed to read sample: %d\n", ret);
> >>>> + dev_err(dev, "failed to read sample: %pe\n", ERR_PTR(ret));
> >>>>
> >>>> ret2 = ad4170_set_channel_enable(st, chan->address, false);
> >>>> if (ret2)
> >>>> - dev_err(dev, "failed to disable channel: %d\n", ret2);
> >>>> + dev_err(dev, "failed to disable channel: %pe\n", ERR_PTR(ret2));
> >>>>
> >>>> return ret;
> >>>> }
> >>>
> >>> Interesting, I didn't know we had this format specifier. But I think
> >>> this is something we would want to do kernel-wide or not at all to stay
> >>> consistent.
> >>
> >> I'm sorry but I didn't follow. This is a kernel-wide format specifier.
>
> I meant that it would be strange to make this change just in one
> driver and not do the same everywhere else.
But it's how we usually do things in the kernel,
subsystem-by-subsystem or even driver-by-driver depending on the
cases. And currently it's used in many already. But if we are talking
about IIO, we need to agree which cases are okay to move to and which
are not (besides the fact that this should be applicable only for
error pointers without additional castings).
> > And to be clear: I am not in favour of this change exactly due to a
> > bit weird (for the reader) castings just for the sake of use of %pe.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists