Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

staging: iio: ad5933: Correct settling cycles encoding per datasheet

The AD5933 datasheet (Table 13) lists the maximum cycles to be 0x7FC
(2044).

Clamp the user input to the maximum effective value of 0x7FC cycles.

Fixes: f94aa354d676 ("iio: impedance-analyzer: New driver for AD5933/4 Impedance Converter, Network Analyzer")
Cc: stable@vger.kernel.org
Signed-off-by: Gabriel Shahrouzi <gshahrouzi@gmail.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250420013009.847851-1-gshahrouzi@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Gabriel Shahrouzi and committed by
Jonathan Cameron
60638e2a b31a7407

+1 -1
+1 -1
drivers/staging/iio/impedance-analyzer/ad5933.c
··· 413 413 ret = ad5933_cmd(st, 0); 414 414 break; 415 415 case AD5933_OUT_SETTLING_CYCLES: 416 - val = clamp(val, (u16)0, (u16)0x7FF); 416 + val = clamp(val, (u16)0, (u16)0x7FC); 417 417 st->settling_cycles = val; 418 418 419 419 /* 2x, 4x handling, see datasheet */