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 <sylvio.alves@espressif.com>
This commit is contained in:
Sylvio Alves
2026-01-14 10:00:57 -03:00
committed by Henrik Brix Andersen
parent a5dd03b029
commit be501ebb06

View File

@@ -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;