The GPIO get callback is expected to return 0 or 1 (or a negative error
code). Ensure that the value returned by ti_ads7950_get() for output
pins is normalized to the [0, 1] range.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/iio/adc/ti-ads7950.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ti-ads7950.c b/drivers/iio/adc/ti-ads7950.c
index bbe1ce577789..b8cc39fc39fb 100644
--- a/drivers/iio/adc/ti-ads7950.c
+++ b/drivers/iio/adc/ti-ads7950.c
@@ -433,7 +433,7 @@ static int ti_ads7950_get(struct gpio_chip *chip, unsigned int offset)
/* If set as output, return the output */
if (st->gpio_cmd_settings_bitmask & BIT(offset)) {
- ret = st->cmd_settings_bitmask & BIT(offset);
+ ret = (st->cmd_settings_bitmask & BIT(offset)) ? 1 : 0;
goto out;
}
--
2.53.0.335.g19a08e0c02-goog
On Wed, 18 Feb 2026 18:29:25 -0800
Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> The GPIO get callback is expected to return 0 or 1 (or a negative error
> code). Ensure that the value returned by ti_ads7950_get() for output
> pins is normalized to the [0, 1] range.
Fixes? I'm not quite sure with something that says 'expected'
Jonathan
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> drivers/iio/adc/ti-ads7950.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/ti-ads7950.c b/drivers/iio/adc/ti-ads7950.c
> index bbe1ce577789..b8cc39fc39fb 100644
> --- a/drivers/iio/adc/ti-ads7950.c
> +++ b/drivers/iio/adc/ti-ads7950.c
> @@ -433,7 +433,7 @@ static int ti_ads7950_get(struct gpio_chip *chip, unsigned int offset)
>
> /* If set as output, return the output */
> if (st->gpio_cmd_settings_bitmask & BIT(offset)) {
> - ret = st->cmd_settings_bitmask & BIT(offset);
> + ret = (st->cmd_settings_bitmask & BIT(offset)) ? 1 : 0;
> goto out;
> }
>
On Sun, Feb 22, 2026 at 02:03:15PM +0000, Jonathan Cameron wrote: > On Wed, 18 Feb 2026 18:29:25 -0800 > Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote: > > > The GPIO get callback is expected to return 0 or 1 (or a negative error > > code). Ensure that the value returned by ti_ads7950_get() for output > > pins is normalized to the [0, 1] range. > Fixes? I'm not quite sure with something that says 'expected' Will add a tag. Thanks. -- Dmitry
On Thu, Feb 19, 2026 at 3:29 AM Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote: > The GPIO get callback is expected to return 0 or 1 (or a negative error > code). Ensure that the value returned by ti_ads7950_get() for output > pins is normalized to the [0, 1] range. > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: Linus Walleij <linusw@kernel.org> Yours, Linus Walleij
On Thu, 19 Feb 2026 03:29:25 +0100, Dmitry Torokhov
<dmitry.torokhov@gmail.com> said:
> The GPIO get callback is expected to return 0 or 1 (or a negative error
> code). Ensure that the value returned by ti_ads7950_get() for output
> pins is normalized to the [0, 1] range.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> drivers/iio/adc/ti-ads7950.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/ti-ads7950.c b/drivers/iio/adc/ti-ads7950.c
> index bbe1ce577789..b8cc39fc39fb 100644
> --- a/drivers/iio/adc/ti-ads7950.c
> +++ b/drivers/iio/adc/ti-ads7950.c
> @@ -433,7 +433,7 @@ static int ti_ads7950_get(struct gpio_chip *chip, unsigned int offset)
>
> /* If set as output, return the output */
> if (st->gpio_cmd_settings_bitmask & BIT(offset)) {
> - ret = st->cmd_settings_bitmask & BIT(offset);
> + ret = (st->cmd_settings_bitmask & BIT(offset)) ? 1 : 0;
> goto out;
> }
>
> --
> 2.53.0.335.g19a08e0c02-goog
>
>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
On Wed, Feb 18, 2026 at 06:29:25PM -0800, Dmitry Torokhov wrote: > The GPIO get callback is expected to return 0 or 1 (or a negative error > code). Ensure that the value returned by ti_ads7950_get() for output > pins is normalized to the [0, 1] range. Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> -- With Best Regards, Andy Shevchenko
© 2016 - 2026 Red Hat, Inc.