Re: [PATCH v1 2/4] iio: imu: inv_mpu6050: Unshadow error codes in ->store()
"Maxwell Doose" <[email protected]>
| Newsgroups | org.kernel.vger.linux-iio,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On Thu Aug 13, 2026 at 2:16 AM CDT Andy Shevchenko <[email protected]> wrote: > 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 <[email protected]> > --- > drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c > index 5796896d54cd..38c3f3b398d4 100644 > --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c > +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c > @@ -13,6 +13,7 @@ > #include <linux/irq.h> > #include <linux/interrupt.h> > #include <linux/acpi.h> > +#include <linux/kstrtox.h> > #include <linux/platform_device.h> > #include <linux/regulator/consumer.h> > #include <linux/math64.h> > @@ -1303,8 +1304,9 @@ inv_mpu6050_fifo_rate_store(struct device *dev, struct device_attribute *attr, > struct inv_mpu6050_state *st = iio_priv(indio_dev); > struct device *pdev = regmap_get_device(st->map); > > - if (kstrtoint(buf, 10, &fifo_rate)) > - return -EINVAL; > + result = kstrtoint(buf, 10, &fifo_rate); > + if (result) > + return result; I suppose result is what was being used before? Oh well doesn't seem worth it to send a patch *just* to change to int ret. Reviewed-by: Maxwell Doose <[email protected]> thanks, max > if (fifo_rate < INV_MPU6050_MIN_FIFO_RATE || > fifo_rate > INV_MPU6050_MAX_FIFO_RATE) > return -EINVAL;