drivers: dac: fix disable callback check#11562
Conversation
_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 <35417409+Old-Ding@users.noreply.github.com>
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
📌 Code Review Assignment🏷️ Tag: componentsReviewers: @Maihuanyi Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2026-07-06 05:28 CST)
📝 Review Instructions
|
Summary
_dac_control()ops->disabledbefore dispatchingRT_DAC_CMD_DISABLEWhy
The disable path currently checks
ops->enabledand then callsops->disabled. This can reject DAC drivers that provide a disable callback without enable, and can call a NULLdisabledcallback when only enable is implemented.Testing
git diff --check origin/master...HEADgit show --stat --check --format=fuller HEAD