[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191103102749.7507e410@archlinux>
Date: Sun, 3 Nov 2019 10:27:49 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Alexandru Ardelean <alexandru.ardelean@...log.com>
Cc: <linux-iio@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<lars@...afoo.de>, <Michael.Hennerich@...log.com>,
<dragos.bogdan@...log.com>
Subject: Re: [PATCH 04/10] iio: imu: adis16480: check ret val for non-zero
vs less-than-zero
On Fri, 1 Nov 2019 11:34:59 +0200
Alexandru Ardelean <alexandru.ardelean@...log.com> wrote:
> The ADIS library functions return zero on success, and negative values for
> error. Positive values aren't returned, but we only care about the success
> value (which is zero).
>
> This change is mostly needed so that the compiler won't make any inferences
> about some about values being potentially un-initialized. This only
> triggers after making some functions inline, because the compiler can
> better follow return paths.
>
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@...log.com>
Applied.
Thanks,
Jonathan
> ---
> drivers/iio/imu/adis16480.c | 28 ++++++++++++++--------------
> 1 file changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c
> index b99d73887c9f..86801f3c5f0d 100644
> --- a/drivers/iio/imu/adis16480.c
> +++ b/drivers/iio/imu/adis16480.c
> @@ -181,7 +181,7 @@ static ssize_t adis16480_show_firmware_revision(struct file *file,
> int ret;
>
> ret = adis_read_reg_16(&adis16480->adis, ADIS16480_REG_FIRM_REV, &rev);
> - if (ret < 0)
> + if (ret)
> return ret;
>
> len = scnprintf(buf, sizeof(buf), "%x.%x\n", rev >> 8, rev & 0xff);
> @@ -206,11 +206,11 @@ static ssize_t adis16480_show_firmware_date(struct file *file,
> int ret;
>
> ret = adis_read_reg_16(&adis16480->adis, ADIS16480_REG_FIRM_Y, &year);
> - if (ret < 0)
> + if (ret)
> return ret;
>
> ret = adis_read_reg_16(&adis16480->adis, ADIS16480_REG_FIRM_DM, &md);
> - if (ret < 0)
> + if (ret)
> return ret;
>
> len = snprintf(buf, sizeof(buf), "%.2x-%.2x-%.4x\n",
> @@ -234,7 +234,7 @@ static int adis16480_show_serial_number(void *arg, u64 *val)
>
> ret = adis_read_reg_16(&adis16480->adis, ADIS16480_REG_SERIAL_NUM,
> &serial);
> - if (ret < 0)
> + if (ret)
> return ret;
>
> *val = serial;
> @@ -252,7 +252,7 @@ static int adis16480_show_product_id(void *arg, u64 *val)
>
> ret = adis_read_reg_16(&adis16480->adis, ADIS16480_REG_PROD_ID,
> &prod_id);
> - if (ret < 0)
> + if (ret)
> return ret;
>
> *val = prod_id;
> @@ -270,7 +270,7 @@ static int adis16480_show_flash_count(void *arg, u64 *val)
>
> ret = adis_read_reg_32(&adis16480->adis, ADIS16480_REG_FLASH_CNT,
> &flash_count);
> - if (ret < 0)
> + if (ret)
> return ret;
>
> *val = flash_count;
> @@ -359,7 +359,7 @@ static int adis16480_get_freq(struct iio_dev *indio_dev, int *val, int *val2)
> reg = ADIS16480_REG_DEC_RATE;
>
> ret = adis_read_reg_16(&st->adis, reg, &t);
> - if (ret < 0)
> + if (ret)
> return ret;
>
> /*
> @@ -462,7 +462,7 @@ static int adis16480_get_calibbias(struct iio_dev *indio_dev,
> ret = -EINVAL;
> }
>
> - if (ret < 0)
> + if (ret)
> return ret;
>
> return IIO_VAL_INT;
> @@ -489,7 +489,7 @@ static int adis16480_get_calibscale(struct iio_dev *indio_dev,
> int ret;
>
> ret = adis_read_reg_16(&st->adis, reg, &val16);
> - if (ret < 0)
> + if (ret)
> return ret;
>
> *scale = sign_extend32(val16, 15);
> @@ -535,7 +535,7 @@ static int adis16480_get_filter_freq(struct iio_dev *indio_dev,
> enable_mask = BIT(offset + 2);
>
> ret = adis_read_reg_16(&st->adis, reg, &val);
> - if (ret < 0)
> + if (ret)
> return ret;
>
> if (!(val & enable_mask))
> @@ -561,7 +561,7 @@ static int adis16480_set_filter_freq(struct iio_dev *indio_dev,
> enable_mask = BIT(offset + 2);
>
> ret = adis_read_reg_16(&st->adis, reg, &val);
> - if (ret < 0)
> + if (ret)
> return ret;
>
> if (freq == 0) {
> @@ -937,7 +937,7 @@ static int adis16480_enable_irq(struct adis *adis, bool enable)
> int ret;
>
> ret = adis_read_reg_16(adis, ADIS16480_REG_FNCTIO_CTRL, &val);
> - if (ret < 0)
> + if (ret)
> return ret;
>
> val &= ~ADIS16480_DRDY_EN_MSK;
> @@ -1115,7 +1115,7 @@ static int adis16480_ext_clk_config(struct adis16480 *st,
> int ret;
>
> ret = adis_read_reg_16(&st->adis, ADIS16480_REG_FNCTIO_CTRL, &val);
> - if (ret < 0)
> + if (ret)
> return ret;
>
> pin = adis16480_of_get_ext_clk_pin(st, of_node);
> @@ -1141,7 +1141,7 @@ static int adis16480_ext_clk_config(struct adis16480 *st,
> val |= mode;
>
> ret = adis_write_reg_16(&st->adis, ADIS16480_REG_FNCTIO_CTRL, val);
> - if (ret < 0)
> + if (ret)
> return ret;
>
> return clk_prepare_enable(st->ext_clk);
Powered by blists - more mailing lists