diff options
author | Tom Joseph <tomjoseph@in.ibm.com> | 2017-09-07 02:04:42 +0530 |
---|---|---|
committer | Tom Joseph <tomjoseph@in.ibm.com> | 2017-09-14 19:20:22 +0530 |
commit | 40c35b1c830c8c903c0120b074a3b7bc631a9861 (patch) | |
tree | 92d42ab5b08679b1757e8da152fb5086bdce2dd4 /sensorhandler.cpp | |
parent | 9f9a9a4db617e99df769c32568d83b8180cfd0c7 (diff) | |
download | phosphor-host-ipmid-40c35b1c830c8c903c0120b074a3b7bc631a9861.tar.gz phosphor-host-ipmid-40c35b1c830c8c903c0120b074a3b7bc631a9861.zip |
sensor: Handle the response of find_openbmc_path
The sensor path of the inventory items does not include the
inventory root, so would fail in the case of find_openbmc_path.
If the return code of find_openbmc_path indicates failure, then
it is logged and allowed to continue. The call to find_openbmc_path
would be eventually removed.
Change-Id: I7513bf4ab9b897ff5b64cfb77fd504e6ef4e227a
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
Diffstat (limited to 'sensorhandler.cpp')
-rw-r--r-- | sensorhandler.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/sensorhandler.cpp b/sensorhandler.cpp index 4933afb..1aa5181 100644 --- a/sensorhandler.cpp +++ b/sensorhandler.cpp @@ -477,7 +477,7 @@ ipmi_ret_t ipmi_sen_get_sensor_reading(ipmi_netfn_t netfn, ipmi_cmd_t cmd, { sensor_data_t *reqptr = (sensor_data_t*)request; ipmi_ret_t rc = IPMI_CC_SENSOR_INVALID; - uint8_t type; + uint8_t type = 0; sensorreadingresp_t *resp = (sensorreadingresp_t*) response; int r; dbus_interface_t a; @@ -489,19 +489,22 @@ ipmi_ret_t ipmi_sen_get_sensor_reading(ipmi_netfn_t netfn, ipmi_cmd_t cmd, r = find_openbmc_path(reqptr->sennum, &a); - if (r < 0) { + if (r < 0) + { fprintf(stderr, "Failed to find Sensor 0x%02x\n", reqptr->sennum); - return IPMI_CC_SENSOR_INVALID; } + else + { + type = get_type_from_interface(a); + if(type == 0) { + fprintf(stderr, "Failed to find Sensor 0x%02x\n", reqptr->sennum); + return IPMI_CC_SENSOR_INVALID; + } - type = get_type_from_interface(a); - if(type == 0) { - fprintf(stderr, "Failed to find Sensor 0x%02x\n", reqptr->sennum); - return IPMI_CC_SENSOR_INVALID; + fprintf(stderr, "Bus: %s, Path: %s, Interface: %s\n", a.bus, a.path, + a.interface); } - fprintf(stderr, "Bus: %s, Path: %s, Interface: %s\n", a.bus, a.path, a.interface); - *data_len=0; int64_t raw_value; |