| commit | efe7bd811a144b9aa7599d21d0150d949bb6a056 | [log] [tgz] |
|---|---|---|
| author | Jayanth Othayoth <ojayanth@gmail.com> | Thu Dec 25 06:33:07 2025 -0600 |
| committer | Jayanth Othayoth <ojayanth@gmail.com> | Mon Dec 29 08:06:59 2025 -0600 |
| tree | 4095acba43ede0145fe81afd101231d640ea359a | |
| parent | 3ef588d54cddafc1f5777fef8653aa0388ca6d44 [diff] |
clang-tidy: guard optional timer before deref
Fix bugprone-unchecked-optional-access warnings by checking
request->timer before calling cancel(), expires_after(), and
async_wait(). Ensures safe access to optional values without
changing functional behavior.
Fixed below errors
'''
../ipmbbridged.cpp:361:13: error: unchecked access to optional value [bugprone-unchecked-optional-access,-warnings-as-errors]
361 | request->timer->cancel();
| ^~~~~~~~~~~~~~
../ipmbbridged.cpp:775:9: error: unchecked access to optional value [bugprone-unchecked-optional-access,-warnings-as-errors]
775 | request->timer->expires_after(
| ^~~~~~~~~~~~~~
../ipmbbridged.cpp:777:9: error: unchecked access to optional value [bugprone-unchecked-optional-access,-warnings-as-errors]
777 | request->timer->async_wait(yield[ec]);
'''
Change-Id: I99f34617aecb7d0269ea746eaff2f47dad59f980
Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com>
Sample config options available to configure :
Single channel with one me and ipmb :
{ "channels": [ { "type": "me", "slave-path": "/dev/ipmb-4", "bmc-addr": 32, "remote-addr": 44 }, { "type": "ipmb", "slave-path": "/dev/ipmb-9", "bmc-addr": 32, "remote-addr": 96 } ] }
Multiple sub channels with me and ipmb :
{ "channels": [ { "type": "me", "slave-path": "/dev/ipmb-1", "bmc-addr": 32, "remote-addr": 64, "devIndex": 0 }, { "type": "ipmb", "slave-path": "/dev/ipmb-3", "bmc-addr": 32, "remote-addr": 64, "devIndex": 0 }, { "type": "me", "slave-path": "/dev/ipmb-5", "bmc-addr": 32, "remote-addr": 64, "devIndex": 1 }, { "type": "ipmb", "slave-path": "/dev/ipmb-7", "bmc-addr": 32, "remote-addr": 64, "devIndex": 1 } ] }
Config fields : type : This points to the ChannelType. It can be ME or ipmb channel. slave-path : The ipmb device path. bmc-addr : This is BMC target address to communicate between BMC and device. remote-addr : This is Remote/requester target address to communicate between BMC and device. devIndex : This devIndex used to identify the particular device/host.