Re: [PATCH 1/3] iio: filter: admv8818: Add missing error code
From: Andy Shevchenko
Date: Fri Feb 27 2026 - 02:05:10 EST
On Fri, Feb 27, 2026 at 12:14:22AM -0600, Ethan Tidmore wrote:
> If the macro FIELD_GET() returns an error code the function returns
> with 0 because ret was just confirmed to be 0 a few lines above.
>
> Add error code.
>
> Detected by Smatch:
> drivers/iio/filter/admv8818.c:335 __admv8818_read_hpf_freq() warn:
> missing error code? 'ret'
>
> drivers/iio/filter/admv8818.c:376 __admv8818_read_lpf_freq()
> warn: missing error code? 'ret'
...
> @@ -332,7 +332,7 @@ static int __admv8818_read_hpf_freq(struct admv8818_state *st, u64 *hpf_freq)
> hpf_band = FIELD_GET(ADMV8818_SW_IN_WR0_MSK, data);
> if (!hpf_band || hpf_band > 4) {
> *hpf_freq = 0;
> - return ret;
> + return -EINVAL;
Looking at the nature of the check I would rather change the condition
to use in_range() and respectively return -ERANGE.
> }
...
> lpf_band = FIELD_GET(ADMV8818_SW_OUT_WR0_MSK, data);
> if (!lpf_band || lpf_band > 4) {
> *lpf_freq = 0;
> - return ret;
> + return -EINVAL;
> }
Ditto.
--
With Best Regards,
Andy Shevchenko