This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 774387d98020e2803d155b91fd34651d460e1b7c Author: Daniel P. Carvalho <[email protected]> AuthorDate: Fri Sep 18 11:27:04 2026 -0300 stm32/comp: propagate enable error and handle lock in ioctl In comp_ioctl(), propagate the return code of comp_enable() to caller so failures (such as when the comparator CSR register is locked) return -EPERM. Also call comp_lock_set() if the comparator was configured with locking, handling cases where initialization was delayed. Assisted-by: Gemini:gemini-3.8-pro Signed-off-by: Daniel P. Carvalho <[email protected]> --- arch/arm/src/common/stm32/stm32_comp_m3m4_v2.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm/src/common/stm32/stm32_comp_m3m4_v2.c b/arch/arm/src/common/stm32/stm32_comp_m3m4_v2.c index 53ebc1b1567..78421e6346e 100644 --- a/arch/arm/src/common/stm32/stm32_comp_m3m4_v2.c +++ b/arch/arm/src/common/stm32/stm32_comp_m3m4_v2.c @@ -929,7 +929,12 @@ static int comp_ioctl(struct comp_dev_s *dev, int cmd, unsigned long arg) { /* Enable comparator */ - comp_enable(priv, true); + ret = comp_enable(priv, true); + if (ret == OK && priv->lock) + { + comp_lock_set(priv, true); + } + break; } @@ -937,7 +942,7 @@ static int comp_ioctl(struct comp_dev_s *dev, int cmd, unsigned long arg) { /* Disable comparator */ - comp_enable(priv, false); + ret = comp_enable(priv, false); break; }
