summaryrefslogtreecommitdiff
path: root/components/drivers
diff options
context:
space:
mode:
authorOld-Ding <[email protected]>2026-07-06 05:24:07 +0800
committerRbb666 <[email protected]>2026-07-08 13:24:42 +0800
commitb9550aad85cfedbad660a1d948417fa93be85163 (patch)
treefc6e774922ee69ff448f40b29431084cee51ff1f /components/drivers
parentd8a7e3eeb03ef68b85d957aa2077d81f437ca67f (diff)
drivers: dac: Fix disable callback check
_dac_control() checked the enabled callback before invoking disabled for RT_DAC_CMD_DISABLE. That can reject DAC drivers that provide a disable callback without enable, and can call through a NULL disabled callback when only enable is implemented. Check the disabled callback in the disable command path so the guard matches the operation being dispatched. Generated-by: OpenAI Codex Signed-off-by: Old-Ding <[email protected]>
Diffstat (limited to 'components/drivers')
-rw-r--r--components/drivers/misc/dac.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/components/drivers/misc/dac.c b/components/drivers/misc/dac.c
index 78db9b1a55..8a1b0ccc72 100644
--- a/components/drivers/misc/dac.c
+++ b/components/drivers/misc/dac.c
@@ -46,7 +46,7 @@ static rt_err_t _dac_control(rt_device_t dev, int cmd, void *args)
{
result = dac->ops->enabled(dac, (rt_uint32_t)args);
}
- else if (cmd == RT_DAC_CMD_DISABLE && dac->ops->enabled)
+ else if (cmd == RT_DAC_CMD_DISABLE && dac->ops->disabled)
{
result = dac->ops->disabled(dac, (rt_uint32_t)args);
}