From: Sanjay Chitroda <sanjayembeddedse@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: lucas.p.stankus@gmail.com, lars@metafoo.de,
Michael.Hennerich@analog.com, jic23@kernel.org,
dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] iio: accel: adxl313: Use dev_err_probe
Date: Fri, 17 Apr 2026 01:11:48 +0530 [thread overview]
Message-ID: <32FEAA09-BCBC-449D-B152-DC3400AEA508@gmail.com> (raw)
In-Reply-To: <aeCcz9GgFmig1d7U@ashevche-desk.local>
On 16 April 2026 1:54:47 pm IST, Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
>On Thu, Apr 16, 2026 at 10:46:31AM +0530, Sanjay Chitroda wrote:
>
>> dev_err_probe() makes error code handling simpler and handle
>> deferred probe nicely (avoid spamming logs).
>
>...
>
>> regmap = devm_regmap_init_i2c(client,
>> &adxl31x_i2c_regmap_config[chip_data->type]);
>> - if (IS_ERR(regmap)) {
>> - dev_err(&client->dev, "Error initializing i2c regmap: %ld\n",
>> - PTR_ERR(regmap));
>> - return PTR_ERR(regmap);
>> - }
>> + if (IS_ERR(regmap))
>> + return dev_err_probe(&client->dev, PTR_ERR(regmap),
>> + "Error initializing i2c regmap\n");
>
>Add
>
> struct device *dev = &client->dev;
>
>to the top of the function and use it here as
>
> if (IS_ERR(regmap))
> return dev_err_probe(dev, PTR_ERR(regmap), "Error initializing i2c regmap\n");
>
>Note, it's fine to have trailing string literals, even in strict mode
>checkpatch won't complain.
>
>...
Thank you Andy for the input.
I will address review comment in next series. Also, string literals is under 100 after the dev changes so keeping single line for both i2c & spi.
>
>> - if (IS_ERR(regmap)) {
>> - dev_err(&spi->dev, "Error initializing spi regmap: %ld\n",
>> - PTR_ERR(regmap));
>> - return PTR_ERR(regmap);
>> - }
>> + if (IS_ERR(regmap))
>> + return dev_err_probe(&spi->dev, PTR_ERR(regmap),
>> + "Error initializing spi regmap\n");
>
>Same way as in I2C driver.
>
next prev parent reply other threads:[~2026-04-16 19:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-16 5:16 [PATCH 0/3] iio: accel: adxl313: small cleanups and error-handling improvements Sanjay Chitroda
2026-04-16 5:16 ` [PATCH 1/3] iio: accel: adxl313_core: Use devm-managed mutex initialization Sanjay Chitroda
2026-04-16 8:25 ` Andy Shevchenko
2026-04-16 5:16 ` [PATCH 2/3] iio: accel: adxl313_core: use guard() to release mutex Sanjay Chitroda
2026-04-16 8:22 ` Andy Shevchenko
2026-04-16 18:22 ` Sanjay Chitroda
2026-04-16 5:16 ` [PATCH 3/3] iio: accel: adxl313: Use dev_err_probe Sanjay Chitroda
2026-04-16 8:24 ` Andy Shevchenko
2026-04-16 19:41 ` Sanjay Chitroda [this message]
2026-04-16 8:16 ` [PATCH 0/3] iio: accel: adxl313: small cleanups and error-handling improvements Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=32FEAA09-BCBC-449D-B152-DC3400AEA508@gmail.com \
--to=sanjayembeddedse@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lucas.p.stankus@gmail.com \
--cc=nuno.sa@analog.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox