summaryrefslogtreecommitdiff
path: root/drivers/iio/dac
diff options
context:
space:
mode:
authorAngelo Dureghello <adureghello@baylibre.com>2025-02-19 19:57:43 +0100
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2025-03-04 13:17:51 +0000
commit25331775b5b4ed45efb37c7e25adad2e8abef948 (patch)
tree33d3dbb90a208b68d61663ac117b1b10fcbf3f42 /drivers/iio/dac
parent583350c1d4d0a9bc63f3e9a4fc662d0d22007bf3 (diff)
iio: dac: adi-axi-dac: add io_mode check
Add safe check to the high bound of the enum values, Signed-off-by: Angelo Dureghello <adureghello@baylibre.com> Link: https://patch.msgid.link/20250219-wip-bl-axi-dac-add-enum-check-v1-1-8de9db0b3b1b@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/dac')
-rw-r--r--drivers/iio/dac/adi-axi-dac.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/iio/dac/adi-axi-dac.c b/drivers/iio/dac/adi-axi-dac.c
index 009fb987e1af..892d770aec69 100644
--- a/drivers/iio/dac/adi-axi-dac.c
+++ b/drivers/iio/dac/adi-axi-dac.c
@@ -728,6 +728,9 @@ static int axi_dac_bus_set_io_mode(struct iio_backend *back,
struct axi_dac_state *st = iio_backend_get_priv(back);
int ival, ret;
+ if (mode > AD3552R_IO_MODE_QSPI)
+ return -EINVAL;
+
guard(mutex)(&st->lock);
ret = regmap_update_bits(st->regmap, AXI_DAC_CUSTOM_CTRL_REG,