From be501ebb0631f954e65e49321616ca688d112874 Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Wed, 14 Jan 2026 10:00:57 -0300 Subject: [PATCH] drivers: i2s: skip syscall validation when unconfiguring stream When frame_clk_freq is set to 0, the I2S API specifies that the stream should transition to NOT_READY state (i.e., unconfigure). In this case, other config fields like mem_slab and block_size are not used by the driver. Skip the mem_slab and block_size validation in the syscall handler when frame_clk_freq is 0 to match the driver behavior and avoid rejecting valid unconfigure requests due to uninitialized fields. Signed-off-by: Sylvio Alves --- drivers/i2s/i2s_handlers.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/i2s/i2s_handlers.c b/drivers/i2s/i2s_handlers.c index 3f1c31a46c7..c9820f00e29 100644 --- a/drivers/i2s/i2s_handlers.c +++ b/drivers/i2s/i2s_handlers.c @@ -23,6 +23,13 @@ static inline int z_vrfy_i2s_configure(const struct device *dev, K_OOPS(k_usermode_from_copy(&config, (const void *)cfg_ptr, sizeof(struct i2s_config))); + /* When frame_clk_freq is 0, the stream is being disabled/unconfigured + * and other config fields are not used, so skip validation. + */ + if (config.frame_clk_freq == 0U) { + goto do_configure; + } + /* Check that the k_mem_slab provided is a valid pointer and that * the caller has permission on it */ @@ -37,6 +44,7 @@ static inline int z_vrfy_i2s_configure(const struct device *dev, goto out; } +do_configure: ret = z_impl_i2s_configure((const struct device *)dev, dir, &config); out: return ret;