[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240420140635.6dffa2fb@jic23-huawei>
Date: Sat, 20 Apr 2024 14:06:35 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Aren Moynihan <aren@...cevolution.org>, Lars-Peter Clausen
<lars@...afoo.de>, Rob Herring <robh@...nel.org>, Krzysztof Kozlowski
<krzysztof.kozlowski+dt@...aro.org>, Conor Dooley <conor+dt@...nel.org>,
Chen-Yu Tsai <wens@...e.org>, Jernej Skrabec <jernej.skrabec@...il.com>,
Samuel Holland <samuel@...lland.org>, Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>, Ondrej Jirman <megi@....cz>, Uwe
Kleine-König <u.kleine-koenig@...gutronix.de>,
linux-iio@...r.kernel.org, phone-devel@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-sunxi@...ts.linux.dev, Willow
Barraco <contact@...lowbarraco.fr>
Subject: Re: [PATCH 3/4] iio: light: stk3310: log error if reading the chip
id fails
On Mon, 15 Apr 2024 18:05:54 +0300
Andy Shevchenko <andy.shevchenko@...il.com> wrote:
> On Sun, Apr 14, 2024 at 8:57 PM Aren Moynihan <aren@...cevolutionorg> wrote:
> >
> > If the chip isn't powered, this call is likely to return an error.
> > Without a log here the driver will silently fail to probe. Common errors
> > are ENXIO (when the chip isn't powered) and ETIMEDOUT (when the i2c bus
> > isn't powered).
>
> > ret = regmap_read(data->regmap, STK3310_REG_ID, &chipid);
> > - if (ret < 0)
> > + if (ret < 0) {
> > + dev_err(&client->dev, "failed to read chip id: %d", ret);
> > return ret;
> > + }
>
> Briefly looking at the code it seems that this one is strictly part of
> the probe phase, which means we may use
>
> return dev_err_probe(...);
>
> pattern. Yet, you may add another patch to clean up all of them:
> _probe(), _init(), _regmap_init() to use the same pattern everywhere.
>
Yes, a precursor patch to use dev_err_probe() throughout the probe only
functions in this driver would be excellent.
Jonathan
Powered by blists - more mailing lists