Linux IIO development
 help / color / mirror / Atom feed
From: <Marius.Cristea@microchip.com>
To: <andriy.shevchenko@linux.intel.com>, <jic23@kernel.org>,
	<maxwell@maxwelld.cc>, <linux-kernel@vger.kernel.org>,
	<sakari.ailus@linux.intel.com>, <linux-iio@vger.kernel.org>
Cc: <tduszyns@gmail.com>, <nuno.sa@analog.com>,
	<dlechner@baylibre.com>, <jean-baptiste.maneyrol@tdk.com>,
	<andy@kernel.org>
Subject: Re: [PATCH v1 4/4] iio: adc: pac1934: Unshadow error codes in ->store()
Date: Thu, 13 Aug 2026 12:17:05 +0000	[thread overview]
Message-ID: <0e2d7ca13a094adad2ade12ef603deefb37cf0f9.camel@microchip.com> (raw)
In-Reply-To: <20260813071912.2465208-5-andriy.shevchenko@linux.intel.com>

On Thu, 2026-08-13 at 09:16 +0200, Andy Shevchenko wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
> 
> kstrtox() may return different error codes.
> 
> Unshadow them in the ->store() callback to give better error report.
> 
> While at it, add missing kstrtox.h inclusion.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/iio/adc/pac1934.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/adc/pac1934.c b/drivers/iio/adc/pac1934.c
> index 23055405a6e0..2d934452eb11 100644
> --- a/drivers/iio/adc/pac1934.c
> +++ b/drivers/iio/adc/pac1934.c
> @@ -19,6 +19,7 @@
>  #include <linux/i2c.h>
>  #include <linux/iio/iio.h>
>  #include <linux/iio/sysfs.h>
> +#include <linux/kstrtox.h>
>  #include <linux/unaligned.h>
> 
>  /*
> @@ -494,11 +495,13 @@ static ssize_t pac1934_shunt_value_store(struct
> device *dev,
>         struct iio_dev *indio_dev = dev_to_iio_dev(dev);
>         struct pac1934_chip_info *info = iio_priv(indio_dev);
>         struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
> -       int sh_val;
> +       unsigned int sh_val;
> +       int ret;
> 
> -       if (kstrtouint(buf, 10, &sh_val)) {
> +       ret = kstrtouint(buf, 10, &sh_val);
> +       if (ret) {
>                 dev_err(dev, "Shunt value is not valid\n");
> -               return -EINVAL;
> +               return ret;
>         }
> 
>         scoped_guard(mutex, &info->lock)
> --
> 2.50.1

Reviewed-by: Marius Cristea <marius.cristea@microchip.com>

  reply	other threads:[~2026-08-13 12:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13  7:16 [PATCH v1 0/4] iio: Unshadow error codes in ->store() Andy Shevchenko
2026-08-13  7:16 ` [PATCH v1 1/4] iio: light: " Andy Shevchenko
2026-08-13 17:51   ` Maxwell Doose
2026-08-13 20:47     ` Andy Shevchenko
2026-08-13  7:16 ` [PATCH v1 2/4] iio: imu: inv_mpu6050: " Andy Shevchenko
2026-08-13 17:57   ` Maxwell Doose
2026-08-13 20:48     ` Andy Shevchenko
2026-08-13  7:16 ` [PATCH v1 3/4] iio: chemical: sps30: " Andy Shevchenko
2026-08-13 17:53   ` Maxwell Doose
2026-08-13  7:16 ` [PATCH v1 4/4] iio: adc: pac1934: " Andy Shevchenko
2026-08-13 12:17   ` Marius.Cristea [this message]
2026-08-13 17:54   ` Maxwell Doose

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=0e2d7ca13a094adad2ade12ef603deefb37cf0f9.camel@microchip.com \
    --to=marius.cristea@microchip.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jean-baptiste.maneyrol@tdk.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxwell@maxwelld.cc \
    --cc=nuno.sa@analog.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tduszyns@gmail.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