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 <danieloak@gmail.com>
This commit is contained in:
Daniel P. Carvalho 2026-09-18 11:27:04 -03:00 • committed by Xiang Xiao
parent 3f4dc2ddf3
commit 774387d980

View file

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