From 25dc5fe96815ab7b1199e8300a56b60595757ed6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 9 Jun 2025 15:16:48 +0200 Subject: [PATCH] drivers: dac: esp32: avoid out-of-range channel ID MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix channel ID check in dac_esp32_channel_setup as it was allowing to set up a channel with ID greater than the number of channels. Signed-off-by: Benjamin Cabé --- drivers/dac/dac_esp32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dac/dac_esp32.c b/drivers/dac/dac_esp32.c index ea10587fe3b..035b3d87573 100644 --- a/drivers/dac/dac_esp32.c +++ b/drivers/dac/dac_esp32.c @@ -39,7 +39,7 @@ static int dac_esp32_channel_setup(const struct device *dev, { ARG_UNUSED(dev); - if (channel_cfg->channel_id > SOC_DAC_CHAN_NUM) { + if (channel_cfg->channel_id >= SOC_DAC_CHAN_NUM) { LOG_ERR("Channel %d is not valid", channel_cfg->channel_id); return -EINVAL; }