* [PATCH] iio: adc: ad7606: Fix incorrect type for error return variable
@ 2025-12-03 5:08 Haotian Zhang
2025-12-03 9:16 ` Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Haotian Zhang @ 2025-12-03 5:08 UTC (permalink / raw)
To: lars, michael.hennerich, jic23
Cc: dlechner, nuno.sa, andy, linux-iio, linux-kernel, Haotian Zhang
The variable ret is declared as unsigned int but is used to store return
values from functions returning int, which may be negative error codes.
Change ret from unsigned int to int.
Fixes: 849cebf8dc67 ("iio: adc: ad7606: Add iio-backend support")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
---
drivers/iio/adc/ad7606_par.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ad7606_par.c b/drivers/iio/adc/ad7606_par.c
index 634852c4bbd2..b81e707ab40c 100644
--- a/drivers/iio/adc/ad7606_par.c
+++ b/drivers/iio/adc/ad7606_par.c
@@ -43,7 +43,8 @@ static int ad7606_par_bus_setup_iio_backend(struct device *dev,
struct iio_dev *indio_dev)
{
struct ad7606_state *st = iio_priv(indio_dev);
- unsigned int ret, c;
+ unsigned int c;
+ int ret;
struct iio_backend_data_fmt data = {
.sign_extend = true,
.enable = true,
--
2.50.1.windows.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: adc: ad7606: Fix incorrect type for error return variable
2025-12-03 5:08 [PATCH] iio: adc: ad7606: Fix incorrect type for error return variable Haotian Zhang
@ 2025-12-03 9:16 ` Andy Shevchenko
2025-12-07 12:56 ` Jonathan Cameron
0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2025-12-03 9:16 UTC (permalink / raw)
To: Haotian Zhang
Cc: lars, michael.hennerich, jic23, dlechner, nuno.sa, andy,
linux-iio, linux-kernel
On Wed, Dec 3, 2025 at 7:09 AM Haotian Zhang <vulab@iscas.ac.cn> wrote:
>
> The variable ret is declared as unsigned int but is used to store return
> values from functions returning int, which may be negative error codes.
>
> Change ret from unsigned int to int.
> Fixes: 849cebf8dc67 ("iio: adc: ad7606: Add iio-backend support")
Since it returns an int, it is just double conversion (however in the
standard promotion from unsigned to signed is UB if I remember
correctly). That said, I am not sure this justifies the Fixes tag, but
I'm not against it.
Reviewed-by: Andy Shevchenko <andy@kernel.org>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: adc: ad7606: Fix incorrect type for error return variable
2025-12-03 9:16 ` Andy Shevchenko
@ 2025-12-07 12:56 ` Jonathan Cameron
0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2025-12-07 12:56 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Haotian Zhang, lars, michael.hennerich, dlechner, nuno.sa, andy,
linux-iio, linux-kernel
On Wed, 3 Dec 2025 11:16:26 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Wed, Dec 3, 2025 at 7:09 AM Haotian Zhang <vulab@iscas.ac.cn> wrote:
> >
> > The variable ret is declared as unsigned int but is used to store return
> > values from functions returning int, which may be negative error codes.
> >
> > Change ret from unsigned int to int.
>
> > Fixes: 849cebf8dc67 ("iio: adc: ad7606: Add iio-backend support")
>
> Since it returns an int, it is just double conversion (however in the
> standard promotion from unsigned to signed is UB if I remember
> correctly). That said, I am not sure this justifies the Fixes tag, but
> I'm not against it.
>
> Reviewed-by: Andy Shevchenko <andy@kernel.org>
>
I think it is worth getting this backported as it's definitely wrong
if not an actual bug so I'll keep the fixes tag and take it via my fixes
branch.
Thanks,
Jonathan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-07 12:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-03 5:08 [PATCH] iio: adc: ad7606: Fix incorrect type for error return variable Haotian Zhang
2025-12-03 9:16 ` Andy Shevchenko
2025-12-07 12:56 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®