Open
fix(bcal): 删除 demo/use 示例中孤立的 gpio->lock(),修复非递归互斥量自死锁 #31
Kunlun_luxiaomuAdd on 3 hours ago
fix(bcal): 删除 demo/use 示例中孤立的 gpio->lock(),修复非递归互斥量自死锁 #31
Open
Kunlun_luxiaomuAdd on 3 hours ago
Kunlun_luxiaomu
Kunlun_luxiaomu
3 hours ago

当前PR是否有AI参与:

[ ] 否
[x] 是
__1. AI Agent 平台: openUBMC 内存检查流水线(openubmc-memory-fix)
__2. AI 模型: CIS-AI4RD-glm-5.3-flash
__3. Prompt上下文 : AI 内存检查流水线:规则扫描 + LLM 逐条二次确认,缺陷修复后交付

PR功能描述 / 为什么需要这个合入:

demo/use/src/main.cpp 原 56 行孤立的 gpio->lock() 与第二次 lock()(原 59 行)不配对,对非递归 std::mutex(GpioImpl::m_hardware_mutex,demo/impl/drivers/gpio/gpio.cpp:46)二次加锁自死锁,首个 unlock 永不可达。

修改方案:

删除 demo/use/src/main.cpp 原 56 行孤立的 gpio->lock();(-1/+0 行),恢复 lock/unlock 一一配对;不新增调用、不改函数签名、不改业务逻辑。

验证方案:

复检通过:写路径 lock→write→unlock、读路径 lock→read→unlock 一一配对;init 路径不触碰 m_hardware_mutex;错误分支(ret != 0 → destroy_driver + return -1)执行时锁已释放。

测试建议:

编译并运行 demo/use 示例,验证 init → write → read 流程正常完成,无阻塞。

自验证报告:

本地复检结论:配对完整性(含错误分支)通过;误报 P-2(dfx/src/main.cpp:53,201,2864-2868)、S-1(main.cpp:46-51,57 原行号对应的早退与 init 异常路径)零改动;无新引入问题(无双锁/双解锁、无顺序倒置、无作用域泄漏);未改业务逻辑。

该PR关联的issue

(格式为fixes #<issue号>, 或者resolves #<issue号>): fixes #13

希望检视人员了解:

本缺陷由 AI 内存检查流水线发现(规则扫描 + LLM 逐条二次确认):demo 示例代码 lock/lock/unlock 不配对导致非递归互斥量自死锁。修复严格限定为删除孤立 lock(),未触碰误报项(P-2、S-1)与需人工项(P-3,src/driver.cpp:159-166 deleter 延迟 dlsym 防御性设计风险,建议由 bcal 驱动工厂维护者评估)。

likedislike
Merge blocked
Kunlun_luxiaomuKunlun_luxiaomu
3 hours ago Created pull request, commit 6ffce932
Kunlun_luxiaomuKunlun_luxiaomu
3 hours ago Associated issue: [缺陷]: bcal demo/use 示例代码 lock/lock/unlock 不配对,非递归互斥量自死锁
openUBMC-robotopenUBMC-robotCollaborators
3 hours ago Set nathanael,xiaoxinglxs,changxingOpenUBMC,yelvsub as approver
openUBMC-robotopenUBMC-robotCollaborators
3 hours ago Added label: sig/sig-hardware
openUBMC-robot
openUBMC-robotCollaborators
3 hours ago Comments:

欢迎来到 openUBMC 社区

Hey @Xixi_0922 , 感谢你对社区的贡献.

机器人使用手册

有关指令的使用,可以点击 说明文档 或 论坛 查看详情。开发人员可以在每个PR或Issue下方评论特定指令来触发机器人任务。您可以自助配置此仓库的 PR 合并规则,更多详情,请参阅机器人自助配置使用手册。

联系指引

有疑问可以联系 SIG: sig-hardware ,
维护者是: @changxingOpenUBMC, @nathanael, @xiaoxinglxs, @yelvsub ,

likedislike
openUBMC-robotopenUBMC-robotCollaborators
3 hours ago Added label: openUBMC-cla/no
openUBMC-robotopenUBMC-robotCollaborators
3 hours ago Added label: ai-co-authored
openUBMC-robot
openUBMC-robotCollaborators
3 hours ago Comments:

CLA 签署引导

@Xixi_0922 , 感谢您的代码贡献。

以下 Commit(s) 没有签署 Contributor License Agreement (CLA)。

Commit 原因
7ca9a2c3 fix(bcal): 删除 demo/use 示��... 这包含一个无效的邮箱,请检查下!

如果您需要签署 CLA,您可以点击此链接去签署 CLA 。

如果需要检查邮箱是否配置正确, 可以点击 FAQs 去查看使用手册 。

在完成 CLA 签署或者更新完邮箱后, 需再次评论 /check-cla 来检查 CLA 的签署状态。

likedislike
openUBMC-robotopenUBMC-robotCollaborators
3 hours ago Added label: ai-includes-code
openUBMC-robotopenUBMC-robotCollaborators
3 hours ago Added label: needs-issue
openUBMC-robot
openUBMC-robotCollaborators
3 hours ago Comments:

关联 Issue 通知

@Xixi_0922 , 提交的PR需要关联issue,指导链接:https://forum.openubmc.cn/t/topic/208
如果已经关联了issue, 但是needs-issue标签仍然存在,你可以在评论 /check-issue 来移除它。

likedislike
openubmc-ci-botopenubmc-ci-botCollaborators
3 hours ago Added label: ci-running
openubmc-ci-bot
openubmc-ci-botCollaborators
3 hours ago Comments:

CI已开始运行,查看流水线详情:流水线链接

likedislike
openubmc-ci-bot
openubmc-ci-botCollaborators
3 hours ago Comments:

/ai review

likedislike
atomgit-bot
atomgit-botCollaborators
3 hours ago Comments:

代码审查

✅ 未发现问题

likedislike
Incorrect?
openUBMC-robotopenUBMC-robotCollaborators
3 hours ago Added label: ai-compliance-failed
openUBMC-robot
openUBMC-robotCollaborators
3 hours ago Comments:

AI Declaration Check Failed

@Xixi_0922, AI declaration is not compliant. AI tool: openUBMC

Please check:

  1. The AI tool and model declared in the PR description must be real.
  2. Commit messages must include the AI model, and it must be consistent with the PR description.

Details: AI Coding Assistants. ⚠️

likedislike
openubmc-ci-botopenubmc-ci-botCollaborators
3 hours ago Added label: limit_1k_suc
openubmc-ci-botopenubmc-ci-botCollaborators
3 hours ago Removed label: ci-running
openubmc-ci-bot
openubmc-ci-botCollaborators
3 hours ago Comments:
任务名称结果
pre-commit检查✅ SUCCESS
PR描述检查✅ SUCCESS
防投毒检查✅ SUCCESS
开源合规检查✅ SUCCESS
修改行数检查✅ SUCCESS
likedislike
openubmc-ci-botopenubmc-ci-botCollaborators
3 hours ago Added label: ci-successful
openubmc-ci-bot
openubmc-ci-botCollaborators
3 hours ago Comments:

CI已执行结束,查看流水线详情:流水线链接

likedislike