Refactoring: get rid of superfluous comparisons

Make code better readable by replacing `if (rsp->ccode > 0)`
and 'if (rsp->ccode != 0)' with just `if (rsp->ccode)` as
rsp->ccode is anyway an unsigned byte and can't be negative.
Also replace 'if (rsp->ccode == 0)' with 'if (!rsp->ccode)'.

All these changes make lines shorter and easier to read as
a non-zero ccode is an indication of some failure, and so !ccode
naturally reads as 'no error'.

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
This commit is contained in:
Alexander Amelkin 2018-08-15 13:16:37 +03:00
parent bb1a4cc805
commit 9ecfb762bd
No known key found for this signature in database
GPG Key ID: E893587B5B74178D
34 changed files with 231 additions and 232 deletions

View File

@ -1636,7 +1636,7 @@ ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id)
printf(" Device not present (No Response)\n"); printf(" Device not present (No Response)\n");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
printf(" Device not present (%s)\n", printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -1683,7 +1683,7 @@ ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id)
spd_data = NULL; spd_data = NULL;
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
printf(" Device not present (%s)\n", printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));

View File

@ -888,7 +888,7 @@ ipmi_start_daemon(struct ipmi_intf *intf)
int int
eval_ccode(const int ccode) eval_ccode(const int ccode)
{ {
if (ccode == 0) { if (!ccode) {
return 0; return 0;
} else if (ccode < 0) { } else if (ccode < 0) {
switch (ccode) { switch (ccode) {
@ -1052,7 +1052,7 @@ ipmi_get_oem_id(struct ipmi_intf *intf)
lprintf(LOG_ERR, "Get Board ID command failed"); lprintf(LOG_ERR, "Get Board ID command failed");
return 0; return 0;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Board ID command failed: %#x %s", lprintf(LOG_ERR, "Get Board ID command failed: %#x %s",
rsp->ccode, val2str(rsp->ccode, completion_code_vals)); rsp->ccode, val2str(rsp->ccode, completion_code_vals));
return 0; return 0;

View File

@ -89,7 +89,7 @@ _ipmi_get_channel_access(struct ipmi_intf *intf,
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) { if (rsp == NULL) {
return (-1); return (-1);
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
return rsp->ccode; return rsp->ccode;
} else if (rsp->data_len != 2) { } else if (rsp->data_len != 2) {
return (-2); return (-2);
@ -130,7 +130,7 @@ _ipmi_get_channel_info(struct ipmi_intf *intf,
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) { if (rsp == NULL) {
return (-1); return (-1);
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
return rsp->ccode; return rsp->ccode;
} else if (rsp->data_len != 9) { } else if (rsp->data_len != 9) {
return (-2); return (-2);
@ -276,7 +276,7 @@ ipmi_get_channel_auth_cap(struct ipmi_intf *intf, uint8_t channel, uint8_t priv)
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if ((rsp == NULL) || (rsp->ccode > 0)) { if (!rsp || rsp->ccode) {
/* /*
* It's very possible that this failed because we asked for IPMI v2 data * It's very possible that this failed because we asked for IPMI v2 data
* Ask again, without requesting IPMI v2 data * Ask again, without requesting IPMI v2 data
@ -288,7 +288,7 @@ ipmi_get_channel_auth_cap(struct ipmi_intf *intf, uint8_t channel, uint8_t priv)
lprintf(LOG_ERR, "Unable to Get Channel Authentication Capabilities"); lprintf(LOG_ERR, "Unable to Get Channel Authentication Capabilities");
return (-1); return (-1);
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Channel Authentication Capabilities failed: %s", lprintf(LOG_ERR, "Get Channel Authentication Capabilities failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return (-1); return (-1);
@ -378,7 +378,7 @@ ipmi_get_channel_cipher_suites(struct ipmi_intf *intf, const char *payload_type,
lprintf(LOG_ERR, "Unable to Get Channel Cipher Suites"); lprintf(LOG_ERR, "Unable to Get Channel Cipher Suites");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Channel Cipher Suites failed: %s", lprintf(LOG_ERR, "Get Channel Cipher Suites failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -413,7 +413,7 @@ ipmi_get_channel_cipher_suites(struct ipmi_intf *intf, const char *payload_type,
lprintf(LOG_ERR, "Unable to Get Channel Cipher Suites"); lprintf(LOG_ERR, "Unable to Get Channel Cipher Suites");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Channel Cipher Suites failed: %s", lprintf(LOG_ERR, "Get Channel Cipher Suites failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -648,8 +648,9 @@ ipmi_get_channel_info(struct ipmi_intf *intf, uint8_t channel)
* *
* @channel - IPMI Channel * @channel - IPMI Channel
* *
* returns - IPMI Channel Medium, IPMI_CHANNEL_MEDIUM_RESERVED if ccode > 0, * @returns IPMI Channel Medium
* 0 on error. * @retval IPMI_CHANNEL_MEDIUM_RESERVED if ccode was not IPMI_CC_OK
* @retval 0 on error
*/ */
uint8_t uint8_t
ipmi_get_channel_medium(struct ipmi_intf *intf, uint8_t channel) ipmi_get_channel_medium(struct ipmi_intf *intf, uint8_t channel)
@ -663,7 +664,7 @@ ipmi_get_channel_medium(struct ipmi_intf *intf, uint8_t channel)
return IPMI_CHANNEL_MEDIUM_RESERVED; return IPMI_CHANNEL_MEDIUM_RESERVED;
} else if (ccode < 0 && eval_ccode(ccode) != 0) { } else if (ccode < 0 && eval_ccode(ccode) != 0) {
return 0; return 0;
} else if (ccode > 0) { } else if (ccode) {
lprintf(LOG_ERR, "Get Channel Info command failed: %s", lprintf(LOG_ERR, "Get Channel Info command failed: %s",
val2str(ccode, completion_code_vals)); val2str(ccode, completion_code_vals));
return IPMI_CHANNEL_MEDIUM_RESERVED; return IPMI_CHANNEL_MEDIUM_RESERVED;

View File

@ -61,7 +61,7 @@ ipmi_chassis_power_status(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Unable to get Chassis Power Status"); lprintf(LOG_ERR, "Unable to get Chassis Power Status");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Chassis Power Status failed: %s", lprintf(LOG_ERR, "Get Chassis Power Status failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -101,7 +101,7 @@ ipmi_chassis_power_control(struct ipmi_intf * intf, uint8_t ctl)
val2str(ctl, ipmi_chassis_power_control_vals)); val2str(ctl, ipmi_chassis_power_control_vals));
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Set Chassis Power Control to %s failed: %s", lprintf(LOG_ERR, "Set Chassis Power Control to %s failed: %s",
val2str(ctl, ipmi_chassis_power_control_vals), val2str(ctl, ipmi_chassis_power_control_vals),
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
@ -156,7 +156,7 @@ ipmi_chassis_identify(struct ipmi_intf * intf, char * arg)
lprintf(LOG_ERR, "Unable to set Chassis Identify"); lprintf(LOG_ERR, "Unable to set Chassis Identify");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Set Chassis Identify failed: %s", lprintf(LOG_ERR, "Set Chassis Identify failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
if (identify_data.force_on != 0) { if (identify_data.force_on != 0) {
@ -204,7 +204,7 @@ ipmi_chassis_poh(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Unable to get Chassis Power-On-Hours"); lprintf(LOG_ERR, "Unable to get Chassis Power-On-Hours");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Chassis Power-On-Hours failed: %s", lprintf(LOG_ERR, "Get Chassis Power-On-Hours failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -247,7 +247,7 @@ ipmi_chassis_restart_cause(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Unable to get Chassis Restart Cause"); lprintf(LOG_ERR, "Unable to get Chassis Restart Cause");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Chassis Restart Cause failed: %s", lprintf(LOG_ERR, "Get Chassis Restart Cause failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -308,7 +308,7 @@ ipmi_chassis_status(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Error sending Chassis Status command"); lprintf(LOG_ERR, "Error sending Chassis Status command");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Error sending Chassis Status command: %s", lprintf(LOG_ERR, "Error sending Chassis Status command: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -391,7 +391,7 @@ ipmi_chassis_selftest(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Error sending Get Self Test command"); lprintf(LOG_ERR, "Error sending Get Self Test command");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Error sending Get Self Test command: %s", lprintf(LOG_ERR, "Error sending Get Self Test command: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -466,7 +466,7 @@ ipmi_chassis_set_bootparam(struct ipmi_intf * intf, uint8_t param, uint8_t * dat
lprintf(LOG_ERR, "Error setting Chassis Boot Parameter %d", param); lprintf(LOG_ERR, "Error setting Chassis Boot Parameter %d", param);
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
if (param != 0) { if (param != 0) {
lprintf(LOG_ERR, "Set Chassis Boot Parameter %d failed: %s", lprintf(LOG_ERR, "Set Chassis Boot Parameter %d failed: %s",
param, val2str(rsp->ccode, completion_code_vals)); param, val2str(rsp->ccode, completion_code_vals));
@ -512,7 +512,7 @@ ipmi_chassis_get_bootparam(struct ipmi_intf * intf, char * arg)
lprintf(LOG_ERR, "Error Getting Chassis Boot Parameter %s", arg); lprintf(LOG_ERR, "Error Getting Chassis Boot Parameter %s", arg);
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Chassis Boot Parameter %s failed: %s", lprintf(LOG_ERR, "Get Chassis Boot Parameter %s failed: %s",
arg, val2str(rsp->ccode, completion_code_vals)); arg, val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -855,7 +855,7 @@ ipmi_chassis_get_bootvalid(struct ipmi_intf * intf)
"Error Getting Chassis Boot Parameter %d", param_id); "Error Getting Chassis Boot Parameter %d", param_id);
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Chassis Boot Parameter %d failed: %s", lprintf(LOG_ERR, "Get Chassis Boot Parameter %d failed: %s",
param_id, val2str(rsp->ccode, completion_code_vals)); param_id, val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -1063,7 +1063,7 @@ ipmi_chassis_power_policy(struct ipmi_intf * intf, uint8_t policy)
lprintf(LOG_ERR, "Error in Power Restore Policy command"); lprintf(LOG_ERR, "Error in Power Restore Policy command");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Power Restore Policy command failed: %s", lprintf(LOG_ERR, "Power Restore Policy command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;

View File

@ -707,7 +707,7 @@ chk_rsp(struct ipmi_rs * rsp)
lprintf(LOG_ERR, "\n DCMI request failed because: %s (%x)", lprintf(LOG_ERR, "\n DCMI request failed because: %s (%x)",
val2str(rsp->ccode, dcmi_ccode_vals), rsp->ccode); val2str(rsp->ccode, dcmi_ccode_vals), rsp->ccode);
return 1; return 1;
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "\n DCMI request failed because: %s (%x)", lprintf(LOG_ERR, "\n DCMI request failed because: %s (%x)",
val2str(rsp->ccode, completion_code_vals), rsp->ccode); val2str(rsp->ccode, completion_code_vals), rsp->ccode);
return 1; return 1;
@ -742,7 +742,7 @@ chk_nm_rsp(struct ipmi_rs * rsp)
lprintf(LOG_ERR, "\n NM request failed because: %s (%x)", lprintf(LOG_ERR, "\n NM request failed because: %s (%x)",
val2str(rsp->ccode, nm_ccode_vals), rsp->ccode); val2str(rsp->ccode, nm_ccode_vals), rsp->ccode);
return 1; return 1;
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "\n NM request failed because: %s (%x)", lprintf(LOG_ERR, "\n NM request failed because: %s (%x)",
val2str(rsp->ccode, completion_code_vals), rsp->ccode); val2str(rsp->ccode, completion_code_vals), rsp->ccode);
return 1; return 1;

View File

@ -1211,7 +1211,7 @@ ipmi_lcd_set_kvm(struct ipmi_intf * intf, char status)
lprintf(LOG_ERR, "Error getting LCD status: " lprintf(LOG_ERR, "Error getting LCD status: "
"Command not supported on this system."); "Command not supported on this system.");
return -1; return -1;
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error setting LCD status: %s", lprintf(LOG_ERR, "Error setting LCD status: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
rc= -1; rc= -1;
@ -1257,7 +1257,7 @@ ipmi_lcd_set_lock(struct ipmi_intf * intf, char lock)
lprintf(LOG_ERR, "Error getting LCD status: " lprintf(LOG_ERR, "Error getting LCD status: "
"Command not supported on this system."); "Command not supported on this system.");
rc = -1; rc = -1;
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error setting LCD status: %s", lprintf(LOG_ERR, "Error setting LCD status: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
rc= -1; rc= -1;
@ -1598,7 +1598,7 @@ ipmi_macinfo_drac_idrac_virtual_mac(struct ipmi_intf* intf,uint8_t NicNum)
if (rsp == NULL) { if (rsp == NULL) {
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
return -1; return -1;
} }
if ((IMC_IDRAC_12G_MODULAR == IMC_Type) if ((IMC_IDRAC_12G_MODULAR == IMC_Type)
@ -1694,7 +1694,7 @@ ipmi_macinfo_drac_idrac_mac(struct ipmi_intf* intf,uint8_t NicNum)
lprintf(LOG_ERR, "Error in getting MAC Address"); lprintf(LOG_ERR, "Error in getting MAC Address");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Error in getting MAC Address (%s)", lprintf(LOG_ERR, "Error in getting MAC Address (%s)",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -1760,7 +1760,7 @@ ipmi_macinfo_10g(struct ipmi_intf* intf, uint8_t NicNum)
lprintf(LOG_ERR, "Error in getting MAC Address"); lprintf(LOG_ERR, "Error in getting MAC Address");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Error in getting MAC Address (%s)", lprintf(LOG_ERR, "Error in getting MAC Address (%s)",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -1834,7 +1834,7 @@ ipmi_macinfo_11g(struct ipmi_intf* intf, uint8_t NicNum)
lprintf(LOG_ERR, "Error in getting MAC Address"); lprintf(LOG_ERR, "Error in getting MAC Address");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Error in getting MAC Address (%s)", lprintf(LOG_ERR, "Error in getting MAC Address (%s)",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -1865,7 +1865,7 @@ ipmi_macinfo_11g(struct ipmi_intf* intf, uint8_t NicNum)
lprintf(LOG_ERR, "Error in getting MAC Address"); lprintf(LOG_ERR, "Error in getting MAC Address");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Error in getting MAC Address (%s)", lprintf(LOG_ERR, "Error in getting MAC Address (%s)",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -2056,7 +2056,7 @@ get_nic_selection_mode_12g(struct ipmi_intf* intf,int current_arg,
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "Error in getting nic selection"); lprintf(LOG_ERR, "Error in getting nic selection");
return -1; return -1;
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error in getting nic selection (%s)", lprintf(LOG_ERR, "Error in getting nic selection (%s)",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -2278,7 +2278,7 @@ ipmi_lan_set_nic_selection_12g(struct ipmi_intf * intf, uint8_t * nic_selection)
lprintf(LOG_ERR, lprintf(LOG_ERR,
"FM001 : A required license is missing or expired"); "FM001 : A required license is missing or expired");
return -1; return -1;
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error in setting nic selection (%s)", lprintf(LOG_ERR, "Error in setting nic selection (%s)",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -2306,7 +2306,7 @@ ipmi_lan_set_nic_selection(struct ipmi_intf * intf, uint8_t nic_selection)
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "Error in setting nic selection"); lprintf(LOG_ERR, "Error in setting nic selection");
return -1; return -1;
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error in setting nic selection (%s)", lprintf(LOG_ERR, "Error in setting nic selection (%s)",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -2339,7 +2339,7 @@ ipmi_lan_get_nic_selection(struct ipmi_intf * intf)
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "Error in getting nic selection"); lprintf(LOG_ERR, "Error in getting nic selection");
return -1; return -1;
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error in getting nic selection (%s)", lprintf(LOG_ERR, "Error in getting nic selection (%s)",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -2395,7 +2395,7 @@ ipmi_lan_get_active_nic(struct ipmi_intf * intf)
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "Error in getting Active LOM Status"); lprintf(LOG_ERR, "Error in getting Active LOM Status");
return -1; return -1;
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error in getting Active LOM Status (%s)", lprintf(LOG_ERR, "Error in getting Active LOM Status (%s)",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -2414,7 +2414,7 @@ ipmi_lan_get_active_nic(struct ipmi_intf * intf)
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "Error in getting Active LOM Status"); lprintf(LOG_ERR, "Error in getting Active LOM Status");
return -1; return -1;
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error in getting Active LOM Status (%s)", lprintf(LOG_ERR, "Error in getting Active LOM Status (%s)",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -2652,12 +2652,12 @@ ipmi_get_sensor_reading(struct ipmi_intf *intf, unsigned char sensorNumber,
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) { if (rsp == NULL) {
return 1; return 1;
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
return 1; return 1;
} }
memcpy(pSensorReadingData, rsp->data, sizeof(SensorReadingType)); memcpy(pSensorReadingData, rsp->data, sizeof(SensorReadingType));
/* if there is an error transmitting ipmi command, return error */ /* if there is an error transmitting ipmi command, return error */
if (rsp->ccode != 0) { if (rsp->ccode) {
rc = 1; rc = 1;
} }
/* if sensor messages are disabled, return error*/ /* if sensor messages are disabled, return error*/
@ -2697,7 +2697,7 @@ ipmi_get_power_capstatus_command(struct ipmi_intf * intf)
lprintf(LOG_ERR, lprintf(LOG_ERR,
"FM001 : A required license is missing or expired"); "FM001 : A required license is missing or expired");
return -1; /* Return Error as unlicensed */ return -1; /* Return Error as unlicensed */
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error getting powercap statusr: %s", lprintf(LOG_ERR, "Error getting powercap statusr: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -2748,7 +2748,7 @@ ipmi_set_power_capstatus_command(struct ipmi_intf * intf, uint8_t val)
lprintf(LOG_ERR, lprintf(LOG_ERR,
"FM001 : A required license is missing or expired"); "FM001 : A required license is missing or expired");
return -1; /* return unlicensed Error code */ return -1; /* return unlicensed Error code */
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error setting powercap statusr: %s", lprintf(LOG_ERR, "Error setting powercap statusr: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -2803,7 +2803,7 @@ ipmi_powermgmt(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Error getting BMC time info."); lprintf(LOG_ERR, "Error getting BMC time info.");
return -1; return -1;
} }
if (rsp->ccode != 0) { if (rsp->ccode) {
lprintf(LOG_ERR, lprintf(LOG_ERR,
"Error getting power management information, return code %x", "Error getting power management information, return code %x",
rsp->ccode); rsp->ccode);
@ -2841,7 +2841,7 @@ ipmi_powermgmt(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Error getting power management information: " lprintf(LOG_ERR, "Error getting power management information: "
"Command not supported on this system."); "Command not supported on this system.");
return -1; return -1;
}else if (rsp->ccode != 0) { }else if (rsp->ccode) {
lprintf(LOG_ERR, lprintf(LOG_ERR,
"Error getting power management information, return code %x", "Error getting power management information, return code %x",
rsp->ccode); rsp->ccode);
@ -2944,7 +2944,7 @@ ipmi_powermgmt_clear(struct ipmi_intf * intf, uint8_t clearValue)
lprintf(LOG_ERR, lprintf(LOG_ERR,
"Error clearing power values, command not supported on this system."); "Error clearing power values, command not supported on this system.");
return -1; return -1;
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error clearing power values: %s", lprintf(LOG_ERR, "Error clearing power values: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -3022,7 +3022,7 @@ ipmi_get_power_headroom_command(struct ipmi_intf * intf,uint8_t unit)
lprintf(LOG_ERR, "Error getting power headroom status: " lprintf(LOG_ERR, "Error getting power headroom status: "
"Command not supported on this system "); "Command not supported on this system ");
return -1; return -1;
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error getting power headroom status: %s", lprintf(LOG_ERR, "Error getting power headroom status: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -3089,7 +3089,7 @@ ipmi_get_power_consumption_data(struct ipmi_intf * intf,uint8_t unit)
sdr->record.common->keys.owner_id, sdr->record.common->keys.owner_id,
sdr->record.common->keys.lun, sdr->record.common->keys.lun,
sdr->record.common->keys.channel); sdr->record.common->keys.channel);
if (rsp == NULL || rsp->ccode != 0) { if (rsp == NULL || rsp->ccode) {
lprintf(LOG_ERR, lprintf(LOG_ERR,
"Error : Can not access the System Level sensor data"); "Error : Can not access the System Level sensor data");
return -1; return -1;
@ -3156,7 +3156,7 @@ ipmi_get_instan_power_consmpt_data(struct ipmi_intf * intf,
lprintf(LOG_ERR, "Error getting instantaneous power consumption data: " lprintf(LOG_ERR, "Error getting instantaneous power consumption data: "
"Command not supported on this system."); "Command not supported on this system.");
return -1; return -1;
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error getting instantaneous power consumption data: %s", lprintf(LOG_ERR, "Error getting instantaneous power consumption data: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -3874,7 +3874,7 @@ ipmi_get_sd_card_info(struct ipmi_intf * intf) {
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "Error in getting SD Card Extended Information"); lprintf(LOG_ERR, "Error in getting SD Card Extended Information");
return -1; return -1;
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error in getting SD Card Extended Information (%s)", lprintf(LOG_ERR, "Error in getting SD Card Extended Information (%s)",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -4052,7 +4052,7 @@ CheckSetLEDSupport(struct ipmi_intf * intf)
data[9] = 0x00; data[9] = 0x00;
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL || rsp->ccode != 0) { if (rsp == NULL || rsp->ccode) {
return; return;
} }
SetLEDSupported = 1; SetLEDSupported = 1;
@ -4097,7 +4097,7 @@ ipmi_getdrivemap(struct ipmi_intf * intf, int b, int d, int f, int *bay,
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "Error issuing getdrivemap command."); lprintf(LOG_ERR, "Error issuing getdrivemap command.");
return -1; return -1;
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error issuing getdrivemap command: %s", lprintf(LOG_ERR, "Error issuing getdrivemap command: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -4152,7 +4152,7 @@ ipmi_setled_state(struct ipmi_intf * intf, int bayId, int slotId, int state)
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "Error issuing setled command."); lprintf(LOG_ERR, "Error issuing setled command.");
return -1; return -1;
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error issuing setled command: %s", lprintf(LOG_ERR, "Error issuing setled command: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;

View File

@ -112,7 +112,7 @@ ipmi_send_platform_event(struct ipmi_intf * intf, struct platform_event_msg * em
lprintf(LOG_ERR, "Platform Event Message command failed"); lprintf(LOG_ERR, "Platform Event Message command failed");
return -1; return -1;
} }
else if (rsp->ccode > 0) { else if (rsp->ccode) {
lprintf(LOG_ERR, "Platform Event Message command failed: %s", lprintf(LOG_ERR, "Platform Event Message command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -352,7 +352,7 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
lprintf(LOG_ERR, lprintf(LOG_ERR,
"Command Get Sensor Thresholds failed: invalid response."); "Command Get Sensor Thresholds failed: invalid response.");
return (-1); return (-1);
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Command Get Sensor Thresholds failed: %s", lprintf(LOG_ERR, "Command Get Sensor Thresholds failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return (-1); return (-1);
@ -363,7 +363,7 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
rsp = ipmi_sdr_get_sensor_hysteresis(intf, emsg.sensor_num, rsp = ipmi_sdr_get_sensor_hysteresis(intf, emsg.sensor_num,
target, lun, channel); target, lun, channel);
if (rsp != NULL && rsp->ccode == 0) if (rsp != NULL && !rsp->ccode)
off = dir ? rsp->data[0] : rsp->data[1]; off = dir ? rsp->data[0] : rsp->data[1];
if (off <= 0) if (off <= 0)
off = 1; off = 1;
@ -578,7 +578,7 @@ ipmi_event_fromfile(struct ipmi_intf * intf, char * file)
lprintf(LOG_ERR, "Platform Event Message command failed"); lprintf(LOG_ERR, "Platform Event Message command failed");
rc = -1; rc = -1;
} }
else if (rsp->ccode > 0) { else if (rsp->ccode) {
lprintf(LOG_ERR, "Platform Event Message command failed: %s", lprintf(LOG_ERR, "Platform Event Message command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
rc = -1; rc = -1;

View File

@ -239,7 +239,7 @@ _get_netfn_support(struct ipmi_intf * intf, int channel, unsigned char * lun, un
lprintf(LOG_ERR, "Get NetFn Support command failed"); lprintf(LOG_ERR, "Get NetFn Support command failed");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get NetFn Support command failed: %s", lprintf(LOG_ERR, "Get NetFn Support command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -293,7 +293,7 @@ _get_command_support(struct ipmi_intf * intf,
lprintf(LOG_ERR, "Get Command Support (LUN=%d, NetFn=%d, op=0) command failed", p->lun, p->netfn); lprintf(LOG_ERR, "Get Command Support (LUN=%d, NetFn=%d, op=0) command failed", p->lun, p->netfn);
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Command Support (LUN=%d, NetFn=%d, op=0) command failed: %s", lprintf(LOG_ERR, "Get Command Support (LUN=%d, NetFn=%d, op=0) command failed: %s",
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals)); p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -320,7 +320,7 @@ _get_command_support(struct ipmi_intf * intf,
lprintf(LOG_ERR, "Get Command Support (LUN=%d, NetFn=%d, op=1) command failed", p->lun, p->netfn); lprintf(LOG_ERR, "Get Command Support (LUN=%d, NetFn=%d, op=1) command failed", p->lun, p->netfn);
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Command Support (LUN=%d, NetFn=%d, op=1) command failed: %s", lprintf(LOG_ERR, "Get Command Support (LUN=%d, NetFn=%d, op=1) command failed: %s",
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals)); p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -372,7 +372,7 @@ _get_command_configurable(struct ipmi_intf * intf,
lprintf(LOG_ERR, "Get Configurable Command (LUN=%d, NetFn=%d, op=0) command failed", p->lun, p->netfn); lprintf(LOG_ERR, "Get Configurable Command (LUN=%d, NetFn=%d, op=0) command failed", p->lun, p->netfn);
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Configurable Command (LUN=%d, NetFn=%d, op=0) command failed: %s", lprintf(LOG_ERR, "Get Configurable Command (LUN=%d, NetFn=%d, op=0) command failed: %s",
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals)); p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -399,7 +399,7 @@ _get_command_configurable(struct ipmi_intf * intf,
lprintf(LOG_ERR, "Get Configurable Command (LUN=%d, NetFn=%d, op=1) command failed", p->lun, p->netfn); lprintf(LOG_ERR, "Get Configurable Command (LUN=%d, NetFn=%d, op=1) command failed", p->lun, p->netfn);
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Configurable Command (LUN=%d, NetFn=%d, op=1) command failed: %s", lprintf(LOG_ERR, "Get Configurable Command (LUN=%d, NetFn=%d, op=1) command failed: %s",
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals)); p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -451,7 +451,7 @@ _get_command_enables(struct ipmi_intf * intf,
lprintf(LOG_ERR, "Get Command Enables (LUN=%d, NetFn=%d, op=0) command failed", p->lun, p->netfn); lprintf(LOG_ERR, "Get Command Enables (LUN=%d, NetFn=%d, op=0) command failed", p->lun, p->netfn);
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Command Enables (LUN=%d, NetFn=%d, op=0) command failed: %s", lprintf(LOG_ERR, "Get Command Enables (LUN=%d, NetFn=%d, op=0) command failed: %s",
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals)); p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -478,7 +478,7 @@ _get_command_enables(struct ipmi_intf * intf,
lprintf(LOG_ERR, "Get Command Enables (LUN=%d, NetFn=%d, op=1) command failed", p->lun, p->netfn); lprintf(LOG_ERR, "Get Command Enables (LUN=%d, NetFn=%d, op=1) command failed", p->lun, p->netfn);
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Command Enables (LUN=%d, NetFn=%d, op=1) command failed: %s", lprintf(LOG_ERR, "Get Command Enables (LUN=%d, NetFn=%d, op=1) command failed: %s",
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals)); p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -562,7 +562,7 @@ _set_command_enables(struct ipmi_intf * intf,
lprintf(LOG_ERR, "Set Command Enables (LUN=%d, NetFn=%d, op=0) command failed", p->lun, p->netfn); lprintf(LOG_ERR, "Set Command Enables (LUN=%d, NetFn=%d, op=0) command failed", p->lun, p->netfn);
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Set Command Enables (LUN=%d, NetFn=%d, op=0) command failed: %s", lprintf(LOG_ERR, "Set Command Enables (LUN=%d, NetFn=%d, op=0) command failed: %s",
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals)); p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -583,7 +583,7 @@ _set_command_enables(struct ipmi_intf * intf,
lprintf(LOG_ERR, "Set Command Enables (LUN=%d, NetFn=%d, op=1) command failed", p->lun, p->netfn); lprintf(LOG_ERR, "Set Command Enables (LUN=%d, NetFn=%d, op=1) command failed", p->lun, p->netfn);
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Set Command Enables (LUN=%d, NetFn=%d, op=1) command failed: %s", lprintf(LOG_ERR, "Set Command Enables (LUN=%d, NetFn=%d, op=1) command failed: %s",
p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals)); p->lun, p->netfn, val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -629,7 +629,7 @@ _get_subfn_support(struct ipmi_intf * intf,
lprintf(LOG_ERR, "Get Command Sub-function Support (LUN=%d, NetFn=%d, command=%d) command failed", p->lun, p->netfn, p->command); lprintf(LOG_ERR, "Get Command Sub-function Support (LUN=%d, NetFn=%d, command=%d) command failed", p->lun, p->netfn, p->command);
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Command Sub-function Support (LUN=%d, NetFn=%d, command=%d) command failed: %s", lprintf(LOG_ERR, "Get Command Sub-function Support (LUN=%d, NetFn=%d, command=%d) command failed: %s",
p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals)); p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -676,7 +676,7 @@ _get_subfn_configurable(struct ipmi_intf * intf,
lprintf(LOG_ERR, "Get Configurable Command Sub-function (LUN=%d, NetFn=%d, command=%d) command failed", p->lun, p->netfn, p->command); lprintf(LOG_ERR, "Get Configurable Command Sub-function (LUN=%d, NetFn=%d, command=%d) command failed", p->lun, p->netfn, p->command);
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Configurable Command Sub-function (LUN=%d, NetFn=%d, command=%d) command failed: %s", lprintf(LOG_ERR, "Get Configurable Command Sub-function (LUN=%d, NetFn=%d, command=%d) command failed: %s",
p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals)); p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -723,7 +723,7 @@ _get_subfn_enables(struct ipmi_intf * intf,
lprintf(LOG_ERR, "Get Command Sub-function Enables (LUN=%d, NetFn=%d, command=%d) command failed", p->lun, p->netfn, p->command); lprintf(LOG_ERR, "Get Command Sub-function Enables (LUN=%d, NetFn=%d, command=%d) command failed", p->lun, p->netfn, p->command);
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Command Sub-function Enables (LUN=%d, NetFn=%d, command=%d) command failed: %s", lprintf(LOG_ERR, "Get Command Sub-function Enables (LUN=%d, NetFn=%d, command=%d) command failed: %s",
p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals)); p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -791,7 +791,7 @@ _set_subfn_enables(struct ipmi_intf * intf,
lprintf(LOG_ERR, "Set Command Sub-function Enables (LUN=%d, NetFn=%d, command=%d) command failed", p->lun, p->netfn, p->command); lprintf(LOG_ERR, "Set Command Sub-function Enables (LUN=%d, NetFn=%d, command=%d) command failed", p->lun, p->netfn, p->command);
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Set Command Sub-function Enables (LUN=%d, NetFn=%d, command=%d) command failed: %s", lprintf(LOG_ERR, "Set Command Sub-function Enables (LUN=%d, NetFn=%d, command=%d) command failed: %s",
p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals)); p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals));
return -1; return -1;

View File

@ -276,7 +276,7 @@ build_fru_bloc(struct ipmi_intf * intf, struct fru_info *fru, uint8_t id)
return NULL; return NULL;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR," Device not present (%s)", lprintf(LOG_ERR," Device not present (%s)",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return NULL; return NULL;
@ -567,7 +567,7 @@ write_fru_area(struct ipmi_intf * intf, struct fru_info *fru, uint8_t id,
protected_bloc = 1; protected_bloc = 1;
} }
if (rsp->ccode > 0) if (rsp->ccode)
break; break;
if (protected_bloc == 0) { if (protected_bloc == 0) {
@ -683,7 +683,7 @@ read_fru_area(struct ipmi_intf * intf, struct fru_info *fru, uint8_t id,
lprintf(LOG_NOTICE, "FRU Read failed"); lprintf(LOG_NOTICE, "FRU Read failed");
break; break;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
/* if we get C7h or C8h or CAh return code then we requested too /* if we get C7h or C8h or CAh return code then we requested too
* many bytes at once so try again with smaller size */ * many bytes at once so try again with smaller size */
if ((rsp->ccode == 0xc7 || rsp->ccode == 0xc8 || rsp->ccode == 0xca) if ((rsp->ccode == 0xc7 || rsp->ccode == 0xc8 || rsp->ccode == 0xca)
@ -789,7 +789,7 @@ read_fru_area_section(struct ipmi_intf * intf, struct fru_info *fru, uint8_t id,
lprintf(LOG_NOTICE, "FRU Read failed"); lprintf(LOG_NOTICE, "FRU Read failed");
break; break;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
/* if we get C7 or C8 or CA return code then we requested too /* if we get C7 or C8 or CA return code then we requested too
* many bytes at once so try again with smaller size */ * many bytes at once so try again with smaller size */
if ((rsp->ccode == 0xc7 || rsp->ccode == 0xc8 || rsp->ccode == 0xca) && if ((rsp->ccode == 0xc7 || rsp->ccode == 0xc8 || rsp->ccode == 0xca) &&
@ -2895,7 +2895,7 @@ __ipmi_fru_print(struct ipmi_intf * intf, uint8_t id)
printf(" Device not present (No Response)\n"); printf(" Device not present (No Response)\n");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
printf(" Device not present (%s)\n", printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -2932,7 +2932,7 @@ __ipmi_fru_print(struct ipmi_intf * intf, uint8_t id)
printf(" Device not present (No Response)\n"); printf(" Device not present (No Response)\n");
return 1; return 1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
printf(" Device not present (%s)\n", printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return 1; return 1;
@ -3111,7 +3111,7 @@ ipmi_fru_print_all(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Get Device ID command failed"); lprintf(LOG_ERR, "Get Device ID command failed");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Device ID command failed: %s", lprintf(LOG_ERR, "Get Device ID command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -3230,7 +3230,7 @@ ipmi_fru_read_to_bin(struct ipmi_intf * intf,
if (!rsp) if (!rsp)
return; return;
if (rsp->ccode > 0) { if (rsp->ccode) {
if (rsp->ccode == 0xc3) if (rsp->ccode == 0xc3)
printf (" Timeout accessing FRU info. (Device not present?)\n"); printf (" Timeout accessing FRU info. (Device not present?)\n");
return; return;
@ -3421,7 +3421,7 @@ ipmi_fru_edit_multirec(struct ipmi_intf * intf, uint8_t id ,
printf(" Device not present (No Response)\n"); printf(" Device not present (No Response)\n");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
printf(" Device not present (%s)\n", printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -3626,7 +3626,7 @@ ipmi_fru_get_multirec(struct ipmi_intf * intf, uint8_t id ,
printf(" Device not present (No Response)\n"); printf(" Device not present (No Response)\n");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
printf(" Device not present (%s)\n", printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -3977,7 +3977,7 @@ ipmi_fru_get_multirec_location_from_fru(struct ipmi_intf * intf,
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
if (rsp->ccode == 0xc3) if (rsp->ccode == 0xc3)
printf (" Timeout accessing FRU info. (Device not present?)\n"); printf (" Timeout accessing FRU info. (Device not present?)\n");
else else
@ -4009,7 +4009,7 @@ ipmi_fru_get_multirec_location_from_fru(struct ipmi_intf * intf,
if (!rsp) if (!rsp)
return -1; return -1;
if (rsp->ccode > 0) { if (rsp->ccode) {
if (rsp->ccode == 0xc3) if (rsp->ccode == 0xc3)
printf (" Timeout while reading FRU data. (Device not present?)\n"); printf (" Timeout while reading FRU data. (Device not present?)\n");
return -1; return -1;
@ -4095,7 +4095,7 @@ ipmi_fru_get_internal_use_info( struct ipmi_intf * intf,
printf(" Device not present (No Response)\n"); printf(" Device not present (No Response)\n");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
printf(" Device not present (%s)\n", printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -4131,7 +4131,7 @@ ipmi_fru_get_internal_use_info( struct ipmi_intf * intf,
printf(" Device not present (No Response)\n"); printf(" Device not present (No Response)\n");
return 1; return 1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
printf(" Device not present (%s)\n", printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return 1; return 1;
@ -4678,7 +4678,7 @@ f_type, uint8_t f_index, char *f_string)
rc = (-1); rc = (-1);
goto ipmi_fru_set_field_string_out; goto ipmi_fru_set_field_string_out;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
printf(" Device not present (%s)\n", printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
rc = (-1); rc = (-1);
@ -4715,7 +4715,7 @@ f_type, uint8_t f_index, char *f_string)
rc = (-1); rc = (-1);
goto ipmi_fru_set_field_string_out; goto ipmi_fru_set_field_string_out;
} }
if (rsp->ccode > 0) if (rsp->ccode)
{ {
printf(" Device not present (%s)\n", printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));

View File

@ -454,7 +454,7 @@ KfwumGetInfo(struct ipmi_intf *intf, unsigned char output,
if (!rsp) { if (!rsp) {
lprintf(LOG_ERR, "Error in FWUM Firmware Get Info Command."); lprintf(LOG_ERR, "Error in FWUM Firmware Get Info Command.");
return (-1); return (-1);
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "FWUM Firmware Get Info returned %x", lprintf(LOG_ERR, "FWUM Firmware Get Info returned %x",
rsp->ccode); rsp->ccode);
return (-1); return (-1);
@ -552,7 +552,7 @@ KfwumGetDeviceInfo(struct ipmi_intf *intf, unsigned char output,
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "Error in Get Device Id Command"); lprintf(LOG_ERR, "Error in Get Device Id Command");
return (-1); return (-1);
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Get Device Id returned %x", lprintf(LOG_ERR, "Get Device Id returned %x",
rsp->ccode); rsp->ccode);
return (-1); return (-1);
@ -671,7 +671,7 @@ KfwumManualRollback(struct ipmi_intf *intf)
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "Error in FWUM Manual Rollback Command."); lprintf(LOG_ERR, "Error in FWUM Manual Rollback Command.");
return (-1); return (-1);
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, lprintf(LOG_ERR,
"Error in FWUM Manual Rollback Command returned %x", "Error in FWUM Manual Rollback Command returned %x",
rsp->ccode); rsp->ccode);
@ -772,7 +772,7 @@ KfwumSaveFirmwareImage(struct ipmi_intf *intf, unsigned char sequenceNumber,
*pInBufLength = 0; *pInBufLength = 0;
break; break;
} /* For other interface keep trying */ } /* For other interface keep trying */
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
if (rsp->ccode == 0xc0) { if (rsp->ccode == 0xc0) {
sleep(1); sleep(1);
} else if ((rsp->ccode == 0xc7) } else if ((rsp->ccode == 0xc7)
@ -838,7 +838,7 @@ KfwumFinishFirmwareImage(struct ipmi_intf *intf, tKFWUM_InFirmwareInfo firmInfo)
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
} while (rsp == NULL || rsp->ccode == 0xc0); } while (rsp == NULL || rsp->ccode == 0xc0);
if (rsp->ccode != 0) { if (rsp->ccode) {
lprintf(LOG_ERR, lprintf(LOG_ERR,
"FWUM Firmware Finish Firmware Image Download returned %x", "FWUM Firmware Finish Firmware Image Download returned %x",
rsp->ccode); rsp->ccode);

View File

@ -1438,7 +1438,7 @@ HpmfwupgGetDeviceId(struct ipmi_intf *intf, struct ipm_devid_rsp *pGetDevId)
lprintf(LOG_ERR, "Error getting device ID."); lprintf(LOG_ERR, "Error getting device ID.");
return HPMFWUPG_ERROR; return HPMFWUPG_ERROR;
} }
if (rsp->ccode != 0x00) { if (rsp->ccode) {
lprintf(LOG_ERR, "Error getting device ID."); lprintf(LOG_ERR, "Error getting device ID.");
lprintf(LOG_ERR, "compcode=0x%x: %s", lprintf(LOG_ERR, "compcode=0x%x: %s",
rsp->ccode, rsp->ccode,
@ -1467,7 +1467,7 @@ HpmfwupgGetTargetUpgCapabilities(struct ipmi_intf *intf,
"Error getting target upgrade capabilities."); "Error getting target upgrade capabilities.");
return HPMFWUPG_ERROR; return HPMFWUPG_ERROR;
} }
if (rsp->ccode != 0x00) { if (rsp->ccode) {
lprintf(LOG_ERR, lprintf(LOG_ERR,
"Error getting target upgrade capabilities, ccode: 0x%x: %s", "Error getting target upgrade capabilities, ccode: 0x%x: %s",
rsp->ccode, rsp->ccode,
@ -1544,7 +1544,7 @@ HpmfwupgGetComponentProperties(struct ipmi_intf *intf,
"Error getting component properties\n"); "Error getting component properties\n");
return HPMFWUPG_ERROR; return HPMFWUPG_ERROR;
} }
if (rsp->ccode != 0x00) { if (rsp->ccode) {
lprintf(LOG_NOTICE, lprintf(LOG_NOTICE,
"Error getting component properties"); "Error getting component properties");
lprintf(LOG_NOTICE, lprintf(LOG_NOTICE,
@ -1669,7 +1669,7 @@ HpmfwupgAbortUpgrade(struct ipmi_intf *intf,
lprintf(LOG_ERR, "Error - aborting upgrade."); lprintf(LOG_ERR, "Error - aborting upgrade.");
return HPMFWUPG_ERROR; return HPMFWUPG_ERROR;
} }
if (rsp->ccode != 0x00) { if (rsp->ccode) {
lprintf(LOG_ERR, "Error aborting upgrade"); lprintf(LOG_ERR, "Error aborting upgrade");
lprintf(LOG_ERR, "compcode=0x%x: %s", lprintf(LOG_ERR, "compcode=0x%x: %s",
rsp->ccode, rsp->ccode,
@ -1701,7 +1701,7 @@ HpmfwupgInitiateUpgradeAction(struct ipmi_intf *intf,
/* Long duration command handling */ /* Long duration command handling */
if (rsp->ccode == HPMFWUPG_COMMAND_IN_PROGRESS) { if (rsp->ccode == HPMFWUPG_COMMAND_IN_PROGRESS) {
rc = HpmfwupgWaitLongDurationCmd(intf, pFwupgCtx); rc = HpmfwupgWaitLongDurationCmd(intf, pFwupgCtx);
} else if (rsp->ccode != 0x00) { } else if (rsp->ccode) {
lprintf(LOG_NOTICE,"Error initiating upgrade action"); lprintf(LOG_NOTICE,"Error initiating upgrade action");
lprintf(LOG_NOTICE, "compcode=0x%x: %s", lprintf(LOG_NOTICE, "compcode=0x%x: %s",
rsp->ccode, rsp->ccode,
@ -1764,7 +1764,7 @@ HpmfwupgUploadFirmwareBlock(struct ipmi_intf *intf,
/* Long duration command handling */ /* Long duration command handling */
if (rsp->ccode == HPMFWUPG_COMMAND_IN_PROGRESS) { if (rsp->ccode == HPMFWUPG_COMMAND_IN_PROGRESS) {
rc = HpmfwupgWaitLongDurationCmd(intf, pFwupgCtx); rc = HpmfwupgWaitLongDurationCmd(intf, pFwupgCtx);
} else if (rsp->ccode != 0x00) { } else if (rsp->ccode) {
/* PATCH --> This validation is to handle retryables errors codes on IPMB bus. /* PATCH --> This validation is to handle retryables errors codes on IPMB bus.
* This will be fixed in the next release of open ipmi and this * This will be fixed in the next release of open ipmi and this
* check will have to be removed. (Buggy version = 39) * check will have to be removed. (Buggy version = 39)
@ -1954,7 +1954,7 @@ HpmfwupgManualFirmwareRollback(struct ipmi_intf *intf,
printf("Waiting firmware rollback..."); printf("Waiting firmware rollback...");
fflush(stdout); fflush(stdout);
rc = HpmfwupgQueryRollbackStatus(intf, &resCmd, &fwupgCtx); rc = HpmfwupgQueryRollbackStatus(intf, &resCmd, &fwupgCtx);
} else if ( rsp->ccode != 0x00 ) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error sending manual rollback"); lprintf(LOG_ERR, "Error sending manual rollback");
lprintf(LOG_ERR, "compcode=0x%x: %s", lprintf(LOG_ERR, "compcode=0x%x: %s",
rsp->ccode, rsp->ccode,

View File

@ -206,7 +206,7 @@ static int ImeGetInfo(struct ipmi_intf *intf)
lprintf(LOG_ERR, "Get Device ID command failed"); lprintf(LOG_ERR, "Get Device ID command failed");
return IME_ERROR; return IME_ERROR;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Device ID command failed: %s", lprintf(LOG_ERR, "Get Device ID command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return IME_ERROR; return IME_ERROR;
@ -513,7 +513,7 @@ static int ImeUpdatePrepare(struct ipmi_intf *intf)
lprintf(LOG_ERR, "UpdatePrepare command failed"); lprintf(LOG_ERR, "UpdatePrepare command failed");
return IME_ERROR; return IME_ERROR;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "UpdatePrepare command failed: %s", lprintf(LOG_ERR, "UpdatePrepare command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return IME_ERROR; return IME_ERROR;
@ -548,7 +548,7 @@ static int ImeUpdateOpenArea(struct ipmi_intf *intf)
lprintf(LOG_ERR, "UpdateOpenArea command failed"); lprintf(LOG_ERR, "UpdateOpenArea command failed");
return IME_ERROR; return IME_ERROR;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "UpdateOpenArea command failed: %s", lprintf(LOG_ERR, "UpdateOpenArea command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return IME_ERROR; return IME_ERROR;
@ -588,7 +588,7 @@ static int ImeUpdateWriteArea(
lprintf(LOG_ERR, "UpdateWriteArea command failed"); lprintf(LOG_ERR, "UpdateWriteArea command failed");
return IME_ERROR; return IME_ERROR;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "UpdateWriteArea command failed: %s", lprintf(LOG_ERR, "UpdateWriteArea command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
if( rsp->ccode == 0x80) // restart operation if( rsp->ccode == 0x80) // restart operation
@ -635,7 +635,7 @@ static int ImeUpdateCloseArea(
lprintf(LOG_ERR, "UpdateCloseArea command failed"); lprintf(LOG_ERR, "UpdateCloseArea command failed");
return IME_ERROR; return IME_ERROR;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "UpdateCloseArea command failed: %s", lprintf(LOG_ERR, "UpdateCloseArea command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return IME_ERROR; return IME_ERROR;
@ -669,7 +669,7 @@ static int ImeUpdateGetStatus(struct ipmi_intf *intf, tImeStatus *pStatus )
lprintf(LOG_ERR, "UpdatePrepare command failed"); lprintf(LOG_ERR, "UpdatePrepare command failed");
return IME_ERROR; return IME_ERROR;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "UpdatePrepare command failed: %s", lprintf(LOG_ERR, "UpdatePrepare command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return IME_ERROR; return IME_ERROR;
@ -742,7 +742,7 @@ static int ImeUpdateGetCapabilities(struct ipmi_intf *intf, tImeCaps *pCaps )
lprintf(LOG_ERR, "UpdatePrepare command failed"); lprintf(LOG_ERR, "UpdatePrepare command failed");
return IME_ERROR; return IME_ERROR;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "UpdatePrepare command failed: %s", lprintf(LOG_ERR, "UpdatePrepare command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return IME_ERROR; return IME_ERROR;
@ -782,7 +782,7 @@ static int ImeUpdateRegisterUpdate(struct ipmi_intf *intf, tImeUpdateType type)
lprintf(LOG_ERR, "ImeUpdateRegisterUpdate command failed"); lprintf(LOG_ERR, "ImeUpdateRegisterUpdate command failed");
return IME_ERROR; return IME_ERROR;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "ImeUpdateRegisterUpdate command failed: %s", lprintf(LOG_ERR, "ImeUpdateRegisterUpdate command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return IME_ERROR; return IME_ERROR;
@ -813,7 +813,7 @@ static int ImeUpdateShowStatus(struct ipmi_intf *intf)
lprintf(LOG_ERR, "UpdatePrepare command failed"); lprintf(LOG_ERR, "UpdatePrepare command failed");
return IME_ERROR; return IME_ERROR;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "UpdatePrepare command failed: %s", lprintf(LOG_ERR, "UpdatePrepare command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return IME_ERROR; return IME_ERROR;

View File

@ -91,7 +91,7 @@ static int ipmi_get_isol_info(struct ipmi_intf * intf,
lprintf(LOG_ERR, "IPMI v1.5 Serial Over Lan (ISOL) not supported!"); lprintf(LOG_ERR, "IPMI v1.5 Serial Over Lan (ISOL) not supported!");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Error in Get ISOL Config Command: %s", lprintf(LOG_ERR, "Error in Get ISOL Config Command: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -111,7 +111,7 @@ static int ipmi_get_isol_info(struct ipmi_intf * intf,
lprintf(LOG_ERR, "Error in Get ISOL Config Command"); lprintf(LOG_ERR, "Error in Get ISOL Config Command");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Error in Get ISOL Config Command: %s", lprintf(LOG_ERR, "Error in Get ISOL Config Command: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -131,7 +131,7 @@ static int ipmi_get_isol_info(struct ipmi_intf * intf,
lprintf(LOG_ERR, "Error in Get ISOL Config Command"); lprintf(LOG_ERR, "Error in Get ISOL Config Command");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Error in Get ISOL Config Command: %s", lprintf(LOG_ERR, "Error in Get ISOL Config Command: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -275,7 +275,7 @@ static int ipmi_isol_set_param(struct ipmi_intf * intf,
lprintf(LOG_ERR, "Error setting ISOL parameter '%s'", param); lprintf(LOG_ERR, "Error setting ISOL parameter '%s'", param);
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Error setting ISOL parameter '%s': %s", lprintf(LOG_ERR, "Error setting ISOL parameter '%s': %s",
param, val2str(rsp->ccode, completion_code_vals)); param, val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -432,7 +432,7 @@ ipmi_isol_deactivate(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Error deactivating ISOL"); lprintf(LOG_ERR, "Error deactivating ISOL");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Error deactivating ISOL: %s", lprintf(LOG_ERR, "Error deactivating ISOL: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;

View File

@ -191,7 +191,7 @@ ipmi_kontronoem_send_set_large_buffer(struct ipmi_intf *intf,
if (rsp == NULL) { if (rsp == NULL) {
printf("Cannot send large buffer command\n"); printf("Cannot send large buffer command\n");
return(-1); return(-1);
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
printf("Invalid length for the selected interface (%s) %d\n", printf("Invalid length for the selected interface (%s) %d\n",
val2str(rsp->ccode, completion_code_vals), rsp->ccode); val2str(rsp->ccode, completion_code_vals), rsp->ccode);
return(-1); return(-1);
@ -246,7 +246,7 @@ ipmi_kontron_set_serial_number(struct ipmi_intf *intf)
if (rsp == NULL) { if (rsp == NULL) {
printf(" Device not present (No Response)\n"); printf(" Device not present (No Response)\n");
return (-1); return (-1);
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
printf(" This option is not implemented for this board\n"); printf(" This option is not implemented for this board\n");
return (-1); return (-1);
} }
@ -274,7 +274,7 @@ ipmi_kontron_set_serial_number(struct ipmi_intf *intf)
free(sn); free(sn);
sn = NULL; sn = NULL;
return (-1); return (-1);
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
printf(" Device not present (%s)\n", printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
free(sn); free(sn);
@ -307,7 +307,7 @@ ipmi_kontron_set_serial_number(struct ipmi_intf *intf)
free(sn); free(sn);
sn = NULL; sn = NULL;
return (-1); return (-1);
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
printf(" Device not present (%s)\n", printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
free(sn); free(sn);
@ -535,7 +535,7 @@ ipmi_kontron_set_mfg_date (struct ipmi_intf *intf)
if (rsp == NULL) { if (rsp == NULL) {
printf("Device not present (No Response)\n"); printf("Device not present (No Response)\n");
return(-1); return(-1);
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
printf("This option is not implemented for this board\n"); printf("This option is not implemented for this board\n");
return(-1); return(-1);
} }
@ -557,7 +557,7 @@ ipmi_kontron_set_mfg_date (struct ipmi_intf *intf)
if (rsp == NULL) { if (rsp == NULL) {
printf(" Device not present (No Response)\n"); printf(" Device not present (No Response)\n");
return(-1); return(-1);
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
printf(" Device not present (%s)\n", printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return(-1); return(-1);
@ -585,7 +585,7 @@ ipmi_kontron_set_mfg_date (struct ipmi_intf *intf)
if (rsp == NULL) { if (rsp == NULL) {
printf(" Device not present (No Response)\n"); printf(" Device not present (No Response)\n");
return (-1); return (-1);
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
printf(" Device not present (%s)\n", printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return (-1); return (-1);
@ -693,7 +693,7 @@ ipmi_kontron_nextboot_set(struct ipmi_intf *intf, int argc, char **argv)
if (rsp == NULL) { if (rsp == NULL) {
printf("Device not present (No Response)\n"); printf("Device not present (No Response)\n");
return(-1); return(-1);
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
printf("Device not present (%s)\n", printf("Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return (-1); return (-1);

View File

@ -312,11 +312,11 @@ __set_lan_param(struct ipmi_intf * intf, uint8_t chan,
req.msg.data_len = len+2; req.msg.data_len = len+2;
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) { if (!rsp) {
lprintf(LOG_ERR, "Set LAN Parameter failed"); lprintf(LOG_ERR, "Set LAN Parameter failed");
return -1; return -1;
} }
if ((rsp->ccode > 0) && (wait != 0)) { if (rsp->ccode && wait) {
lprintf(LOG_DEBUG, "Warning: Set LAN Parameter failed: %s", lprintf(LOG_DEBUG, "Warning: Set LAN Parameter failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
if (rsp->ccode == 0xcc) { if (rsp->ccode == 0xcc) {
@ -328,9 +328,7 @@ __set_lan_param(struct ipmi_intf * intf, uint8_t chan,
break; break;
sleep(IPMI_LANP_TIMEOUT); sleep(IPMI_LANP_TIMEOUT);
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) if (!rsp || rsp->ccode)
continue;
if (rsp->ccode > 0)
continue; continue;
return set_lan_param_wait(intf, chan, param, data, len); return set_lan_param_wait(intf, chan, param, data, len);
} }
@ -341,7 +339,7 @@ __set_lan_param(struct ipmi_intf * intf, uint8_t chan,
} }
} }
if (wait == 0) if (!wait)
return 0; return 0;
return set_lan_param_wait(intf, chan, param, data, len); return set_lan_param_wait(intf, chan, param, data, len);
} }
@ -2074,7 +2072,7 @@ ipmi_lan_stats_get(struct ipmi_intf * intf, uint8_t chan)
return (-1); return (-1);
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get LAN Stats command failed: %s", lprintf(LOG_ERR, "Get LAN Stats command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return (-1); return (-1);
@ -2150,7 +2148,7 @@ ipmi_lan_stats_clear(struct ipmi_intf * intf, uint8_t chan)
return (-1); return (-1);
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_INFO, "Get LAN Stats command failed: %s", lprintf(LOG_INFO, "Get LAN Stats command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return (-1); return (-1);

View File

@ -89,7 +89,7 @@ ipmi_mc_reset(struct ipmi_intf * intf, int cmd)
} else if (rsp == NULL) { } else if (rsp == NULL) {
lprintf(LOG_ERR, "MC reset command failed."); lprintf(LOG_ERR, "MC reset command failed.");
return (-1); return (-1);
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "MC reset command failed: %s", lprintf(LOG_ERR, "MC reset command failed: %s",
CC_STRING(rsp->ccode)); CC_STRING(rsp->ccode));
return (-1); return (-1);
@ -285,7 +285,7 @@ ipmi_mc_get_enables(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Get Global Enables command failed"); lprintf(LOG_ERR, "Get Global Enables command failed");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Global Enables command failed: %s", lprintf(LOG_ERR, "Get Global Enables command failed: %s",
CC_STRING(rsp->ccode)); CC_STRING(rsp->ccode));
return -1; return -1;
@ -335,7 +335,7 @@ ipmi_mc_set_enables(struct ipmi_intf * intf, int argc, char ** argv)
lprintf(LOG_ERR, "Get Global Enables command failed"); lprintf(LOG_ERR, "Get Global Enables command failed");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Global Enables command failed: %s", lprintf(LOG_ERR, "Get Global Enables command failed: %s",
CC_STRING(rsp->ccode)); CC_STRING(rsp->ccode));
return -1; return -1;
@ -377,7 +377,7 @@ ipmi_mc_set_enables(struct ipmi_intf * intf, int argc, char ** argv)
lprintf(LOG_ERR, "Set Global Enables command failed"); lprintf(LOG_ERR, "Set Global Enables command failed");
return -1; return -1;
} }
else if (rsp->ccode > 0) { else if (rsp->ccode) {
lprintf(LOG_ERR, "Set Global Enables command failed: %s", lprintf(LOG_ERR, "Set Global Enables command failed: %s",
CC_STRING(rsp->ccode)); CC_STRING(rsp->ccode));
return -1; return -1;
@ -427,7 +427,7 @@ ipmi_mc_get_deviceid(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Get Device ID command failed"); lprintf(LOG_ERR, "Get Device ID command failed");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Device ID command failed: %s", lprintf(LOG_ERR, "Get Device ID command failed: %s",
CC_STRING(rsp->ccode)); CC_STRING(rsp->ccode));
return -1; return -1;
@ -509,7 +509,7 @@ _ipmi_mc_get_guid(struct ipmi_intf *intf, struct ipmi_guid_t *guid)
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) { if (rsp == NULL) {
return (-1); return (-1);
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
return rsp->ccode; return rsp->ccode;
} else if (rsp->data_len != 16 } else if (rsp->data_len != 16
|| rsp->data_len != sizeof(struct ipmi_guid_t)) { || rsp->data_len != sizeof(struct ipmi_guid_t)) {
@ -1239,7 +1239,7 @@ ipmi_mc_getsysinfo(struct ipmi_intf * intf, int param, int block, int set,
if (rsp == NULL) if (rsp == NULL)
return (-1); return (-1);
if (rsp->ccode == 0) { if (!rsp->ccode) {
if (len > rsp->data_len) if (len > rsp->data_len)
len = rsp->data_len; len = rsp->data_len;
if (len && buffer) if (len && buffer)

View File

@ -259,7 +259,7 @@ _ipmi_get_pef_capabilities(struct ipmi_intf *intf,
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) { if (rsp == NULL) {
return (-1); return (-1);
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
return rsp->ccode; return rsp->ccode;
} else if (rsp->data_len != 3) { } else if (rsp->data_len != 3) {
return (-2); return (-2);
@ -305,7 +305,7 @@ _ipmi_get_pef_filter_entry(struct ipmi_intf *intf, uint8_t filter_id,
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) { if (rsp == NULL) {
return (-1); return (-1);
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
return rsp->ccode; return rsp->ccode;
} else if (rsp->data_len != 22 || (rsp->data_len - 1) != dest_size) { } else if (rsp->data_len != 22 || (rsp->data_len - 1) != dest_size) {
return (-2); return (-2);
@ -349,7 +349,7 @@ _ipmi_get_pef_filter_entry_cfg(struct ipmi_intf *intf, uint8_t filter_id,
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) { if (rsp == NULL) {
return (-1); return (-1);
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
return rsp->ccode; return rsp->ccode;
} else if (rsp->data_len != 3 || (rsp->data_len - 1) != dest_size) { } else if (rsp->data_len != 3 || (rsp->data_len - 1) != dest_size) {
return (-2); return (-2);
@ -393,7 +393,7 @@ _ipmi_get_pef_policy_entry(struct ipmi_intf *intf, uint8_t policy_id,
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) { if (rsp == NULL) {
return (-1); return (-1);
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
return rsp->ccode; return rsp->ccode;
} else if (rsp->data_len != 5 || (rsp->data_len - 1) != dest_size) { } else if (rsp->data_len != 5 || (rsp->data_len - 1) != dest_size) {
return (-2); return (-2);
@ -432,7 +432,7 @@ _ipmi_get_pef_filter_table_size(struct ipmi_intf *intf, uint8_t *table_size)
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) { if (rsp == NULL) {
return (-1); return (-1);
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
return rsp->ccode; return rsp->ccode;
} else if (rsp->data_len != 2) { } else if (rsp->data_len != 2) {
return (-2); return (-2);
@ -471,7 +471,7 @@ _ipmi_get_pef_policy_table_size(struct ipmi_intf *intf, uint8_t *table_size)
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) { if (rsp == NULL) {
return (-1); return (-1);
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
return rsp->ccode; return rsp->ccode;
} else if (rsp->data_len != 2) { } else if (rsp->data_len != 2) {
return (-2); return (-2);
@ -510,7 +510,7 @@ _ipmi_get_pef_system_guid(struct ipmi_intf *intf,
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) { if (rsp == NULL) {
return (-1); return (-1);
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
return rsp->ccode; return rsp->ccode;
} else if (rsp->data_len != 18 } else if (rsp->data_len != 18
|| (rsp->data_len - 2) != sizeof(system_guid->guid)) { || (rsp->data_len - 2) != sizeof(system_guid->guid)) {
@ -555,7 +555,7 @@ _ipmi_set_pef_filter_entry_cfg(struct ipmi_intf *intf, uint8_t filter_id,
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) { if (rsp == NULL) {
return (-1); return (-1);
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
return rsp->ccode; return rsp->ccode;
} }
return 0; return 0;
@ -595,7 +595,7 @@ _ipmi_set_pef_policy_entry(struct ipmi_intf *intf, uint8_t policy_id,
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) { if (rsp == NULL) {
return (-1); return (-1);
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
return rsp->ccode; return rsp->ccode;
} }
return 0; return 0;

View File

@ -1649,7 +1649,7 @@ ipmi_picmg_clk_get(struct ipmi_intf * intf, uint8_t clk_id, int8_t clk_res,
return -1; return -1;
} }
if (rsp->ccode == 0 ) { if (!rsp->ccode) {
enabled = (rsp->data[1]&0x8)!=0; enabled = (rsp->data[1]&0x8)!=0;
direction = (rsp->data[1]&0x4)!=0; direction = (rsp->data[1]&0x4)!=0;
@ -2353,7 +2353,7 @@ picmg_discover(struct ipmi_intf *intf) {
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_DEBUG,"No response from Get PICMG Properties"); lprintf(LOG_DEBUG,"No response from Get PICMG Properties");
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
lprintf(LOG_DEBUG,"Error response %#x from Get PICMG Properties", lprintf(LOG_DEBUG,"Error response %#x from Get PICMG Properties",
rsp->ccode); rsp->ccode);
} else if (rsp->data_len < 4) { } else if (rsp->data_len < 4) {

View File

@ -105,7 +105,7 @@ ipmi_master_write_read(struct ipmi_intf * intf, uint8_t bus, uint8_t addr,
lprintf(LOG_ERR, "I2C Master Write-Read command failed"); lprintf(LOG_ERR, "I2C Master Write-Read command failed");
return NULL; return NULL;
} }
else if (rsp->ccode > 0) { else if (rsp->ccode) {
switch (rsp->ccode) { switch (rsp->ccode) {
case 0x81: case 0x81:
lprintf(LOG_ERR, "I2C Master Write-Read command failed: Lost Arbitration"); lprintf(LOG_ERR, "I2C Master Write-Read command failed: Lost Arbitration");
@ -385,7 +385,7 @@ ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv)
intf->target_channel & 0x0f, req.msg.netfn, req.msg.lun, req.msg.cmd); intf->target_channel & 0x0f, req.msg.netfn, req.msg.lun, req.msg.cmd);
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Unable to send RAW command " lprintf(LOG_ERR, "Unable to send RAW command "
"(channel=0x%x netfn=0x%x lun=0x%x cmd=0x%x rsp=0x%x): %s", "(channel=0x%x netfn=0x%x lun=0x%x cmd=0x%x rsp=0x%x): %s",
intf->target_channel & 0x0f, req.msg.netfn, req.msg.lun, req.msg.cmd, rsp->ccode, intf->target_channel & 0x0f, req.msg.netfn, req.msg.lun, req.msg.cmd, rsp->ccode,

View File

@ -810,7 +810,7 @@ ipmi_sdr_get_header(struct ipmi_intf *intf, struct ipmi_sdr_iterator *itr)
"Unable to renew SDR reservation"); "Unable to renew SDR reservation");
return NULL; return NULL;
} }
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Get SDR %04x command failed: %s", lprintf(LOG_ERR, "Get SDR %04x command failed: %s",
itr->next, val2str(rsp->ccode, itr->next, val2str(rsp->ccode,
completion_code_vals)); completion_code_vals));
@ -964,7 +964,7 @@ ipmi_sdr_print_sensor_event_status(struct ipmi_intf *intf,
sensor_num); sensor_num);
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_DEBUG, lprintf(LOG_DEBUG,
"Error reading event status for sensor #%02x: %s", "Error reading event status for sensor #%02x: %s",
sensor_num, val2str(rsp->ccode, completion_code_vals)); sensor_num, val2str(rsp->ccode, completion_code_vals));
@ -1178,7 +1178,7 @@ ipmi_sdr_print_sensor_event_enable(struct ipmi_intf *intf,
sensor_num); sensor_num);
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_DEBUG, lprintf(LOG_DEBUG,
"Error reading event enable for sensor #%02x: %s", "Error reading event enable for sensor #%02x: %s",
sensor_num, val2str(rsp->ccode, completion_code_vals)); sensor_num, val2str(rsp->ccode, completion_code_vals));
@ -2793,7 +2793,7 @@ ipmi_sdr_get_reservation(struct ipmi_intf *intf, int use_builtin,
/* be slient for errors, they are handled by calling function */ /* be slient for errors, they are handled by calling function */
if (rsp == NULL) if (rsp == NULL)
return -1; return -1;
if (rsp->ccode > 0) if (rsp->ccode)
return -1; return -1;
*reserve_id = ((struct sdr_reserve_repo_rs *) &(rsp->data))->reserve_id; *reserve_id = ((struct sdr_reserve_repo_rs *) &(rsp->data))->reserve_id;
@ -2838,7 +2838,7 @@ ipmi_sdr_start(struct ipmi_intf *intf, int use_builtin)
itr = NULL; itr = NULL;
return NULL; return NULL;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Device ID command failed: %#x %s", lprintf(LOG_ERR, "Get Device ID command failed: %#x %s",
rsp->ccode, val2str(rsp->ccode, completion_code_vals)); rsp->ccode, val2str(rsp->ccode, completion_code_vals));
free(itr); free(itr);
@ -2880,7 +2880,7 @@ ipmi_sdr_start(struct ipmi_intf *intf, int use_builtin)
itr = NULL; itr = NULL;
return NULL; return NULL;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Error obtaining SDR info: %s", lprintf(LOG_ERR, "Error obtaining SDR info: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
free(itr); free(itr);
@ -3054,7 +3054,7 @@ ipmi_sdr_get_record(struct ipmi_intf * intf, struct sdr_get_rs * header,
} }
/* special completion codes handled above */ /* special completion codes handled above */
if (rsp->ccode > 0 || rsp->data_len == 0) { if (rsp->ccode || rsp->data_len == 0) {
free(data); free(data);
data = NULL; data = NULL;
return NULL; return NULL;
@ -4195,7 +4195,7 @@ ipmi_sdr_get_info(struct ipmi_intf *intf,
lprintf(LOG_ERR, "Get SDR Repository Info command failed"); lprintf(LOG_ERR, "Get SDR Repository Info command failed");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get SDR Repository Info command failed: %s", lprintf(LOG_ERR, "Get SDR Repository Info command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;

View File

@ -206,7 +206,7 @@ ipmi_sdr_repo_clear(struct ipmi_intf *intf)
lprintf(LOG_ERR, "Unable to clear SDRR"); lprintf(LOG_ERR, "Unable to clear SDRR");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Unable to clear SDRR: %s", lprintf(LOG_ERR, "Unable to clear SDRR: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;

View File

@ -318,7 +318,7 @@ ipmi_get_oem(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Get Device ID command failed"); lprintf(LOG_ERR, "Get Device ID command failed");
return IPMI_OEM_UNKNOWN; return IPMI_OEM_UNKNOWN;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get Device ID command failed: %#x %s", lprintf(LOG_ERR, "Get Device ID command failed: %#x %s",
rsp->ccode, val2str(rsp->ccode, completion_code_vals)); rsp->ccode, val2str(rsp->ccode, completion_code_vals));
return IPMI_OEM_UNKNOWN; return IPMI_OEM_UNKNOWN;
@ -351,7 +351,7 @@ ipmi_sel_add_entry(struct ipmi_intf * intf, struct sel_event_record * rec)
lprintf(LOG_ERR, "Add SEL Entry failed"); lprintf(LOG_ERR, "Add SEL Entry failed");
return -1; return -1;
} }
else if (rsp->ccode > 0) { else if (rsp->ccode) {
lprintf(LOG_ERR, "Add SEL Entry failed: %s", lprintf(LOG_ERR, "Add SEL Entry failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -510,7 +510,7 @@ get_newisys_evt_desc(struct ipmi_intf * intf, struct sel_event_record * rec)
lprintf(LOG_ERR, "Error issuing OEM command"); lprintf(LOG_ERR, "Error issuing OEM command");
return NULL; return NULL;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
if (verbose) if (verbose)
lprintf(LOG_ERR, "OEM command returned error code: %s", lprintf(LOG_ERR, "OEM command returned error code: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
@ -589,7 +589,7 @@ get_supermicro_evt_desc(struct ipmi_intf *intf, struct sel_event_record *rec)
desc = NULL; desc = NULL;
} }
return NULL; return NULL;
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, " Error getting system info: %s", lprintf(LOG_ERR, " Error getting system info: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
if (desc != NULL) { if (desc != NULL) {
@ -792,7 +792,7 @@ char * get_dell_evt_desc(struct ipmi_intf * intf, struct sel_event_record * rec)
} }
return NULL; return NULL;
} }
else if (rsp->ccode > 0) else if (rsp->ccode)
{ {
lprintf(LOG_ERR, " Error getting system info: %s", lprintf(LOG_ERR, " Error getting system info: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
@ -1548,7 +1548,7 @@ ipmi_sel_get_info(struct ipmi_intf * intf)
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "Get SEL Info command failed"); lprintf(LOG_ERR, "Get SEL Info command failed");
return -1; return -1;
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Get SEL Info command failed: %s", lprintf(LOG_ERR, "Get SEL Info command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -1631,7 +1631,7 @@ ipmi_sel_get_info(struct ipmi_intf * intf)
"Get SEL Allocation Info command failed"); "Get SEL Allocation Info command failed");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, lprintf(LOG_ERR,
"Get SEL Allocation Info command failed: %s", "Get SEL Allocation Info command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
@ -1676,7 +1676,7 @@ ipmi_sel_get_std_entry(struct ipmi_intf * intf, uint16_t id,
lprintf(LOG_ERR, "Get SEL Entry %x command failed", id); lprintf(LOG_ERR, "Get SEL Entry %x command failed", id);
return 0; return 0;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get SEL Entry %x command failed: %s", lprintf(LOG_ERR, "Get SEL Entry %x command failed: %s",
id, val2str(rsp->ccode, completion_code_vals)); id, val2str(rsp->ccode, completion_code_vals));
return 0; return 0;
@ -2283,7 +2283,7 @@ __ipmi_sel_savelist_entries(struct ipmi_intf * intf, int count, const char * sav
lprintf(LOG_ERR, "Get SEL Info command failed"); lprintf(LOG_ERR, "Get SEL Info command failed");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get SEL Info command failed: %s", lprintf(LOG_ERR, "Get SEL Info command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -2305,7 +2305,7 @@ __ipmi_sel_savelist_entries(struct ipmi_intf * intf, int count, const char * sav
lprintf(LOG_ERR, "Reserve SEL command failed"); lprintf(LOG_ERR, "Reserve SEL command failed");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Reserve SEL command failed: %s", lprintf(LOG_ERR, "Reserve SEL command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -2322,7 +2322,7 @@ __ipmi_sel_savelist_entries(struct ipmi_intf * intf, int count, const char * sav
lprintf(LOG_ERR, "Get SEL Info command failed"); lprintf(LOG_ERR, "Get SEL Info command failed");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get SEL Info command failed: %s", lprintf(LOG_ERR, "Get SEL Info command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -2702,7 +2702,7 @@ ipmi_sel_reserve(struct ipmi_intf * intf)
lprintf(LOG_WARN, "Unable to reserve SEL"); lprintf(LOG_WARN, "Unable to reserve SEL");
return 0; return 0;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
printf("Unable to reserve SEL: %s", printf("Unable to reserve SEL: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return 0; return 0;
@ -2734,7 +2734,7 @@ ipmi_sel_get_time(struct ipmi_intf * intf)
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL || rsp->ccode > 0) { if (rsp == NULL || rsp->ccode) {
lprintf(LOG_ERR, "Get SEL Time command failed: %s", lprintf(LOG_ERR, "Get SEL Time command failed: %s",
rsp rsp
? val2str(rsp->ccode, completion_code_vals) ? val2str(rsp->ccode, completion_code_vals)
@ -2838,7 +2838,7 @@ ipmi_sel_set_time(struct ipmi_intf * intf, const char * time_string)
#endif #endif
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL || rsp->ccode > 0) { if (rsp == NULL || rsp->ccode) {
lprintf(LOG_ERR, "Set SEL Time command failed: %s", lprintf(LOG_ERR, "Set SEL Time command failed: %s",
rsp rsp
? val2str(rsp->ccode, completion_code_vals) ? val2str(rsp->ccode, completion_code_vals)
@ -2883,7 +2883,7 @@ ipmi_sel_clear(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Unable to clear SEL"); lprintf(LOG_ERR, "Unable to clear SEL");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Unable to clear SEL: %s", lprintf(LOG_ERR, "Unable to clear SEL: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -2937,7 +2937,7 @@ ipmi_sel_delete(struct ipmi_intf * intf, int argc, char ** argv)
lprintf(LOG_ERR, "Unable to delete entry %d", id); lprintf(LOG_ERR, "Unable to delete entry %d", id);
rc = -1; rc = -1;
} }
else if (rsp->ccode > 0) { else if (rsp->ccode) {
lprintf(LOG_ERR, "Unable to delete entry %d: %s", id, lprintf(LOG_ERR, "Unable to delete entry %d: %s", id,
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
rc = -1; rc = -1;

View File

@ -266,7 +266,7 @@ ipmi_sensor_print_fc_threshold(struct ipmi_intf *intf,
sensor->keys.sensor_num, sensor->keys.owner_id, sensor->keys.sensor_num, sensor->keys.owner_id,
sensor->keys.lun, sensor->keys.channel); sensor->keys.lun, sensor->keys.channel);
if ((rsp == NULL) || (rsp->ccode > 0) || (rsp->data_len == 0)) if (!rsp || rsp->ccode || !rsp->data_len)
thresh_available = 0; thresh_available = 0;
if (csv_output) { if (csv_output) {
@ -485,7 +485,7 @@ __ipmi_sensor_set_threshold(struct ipmi_intf *intf,
lprintf(LOG_ERR, "Error setting threshold"); lprintf(LOG_ERR, "Error setting threshold");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Error setting threshold: %s", lprintf(LOG_ERR, "Error setting threshold: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -721,7 +721,7 @@ ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
sdr->record.common->keys.owner_id, sdr->record.common->keys.owner_id,
sdr->record.common->keys.lun, sdr->record.common->keys.lun,
sdr->record.common->keys.channel); sdr->record.common->keys.channel);
if ((rsp == NULL) || (rsp->ccode > 0)) { if (!rsp || rsp->ccode) {
lprintf(LOG_ERR, "Sensor data record not found!"); lprintf(LOG_ERR, "Sensor data record not found!");
return -1; return -1;
} }

View File

@ -293,7 +293,7 @@ ipmi_get_session_info(struct ipmi_intf * intf,
lprintf(LOG_ERR, "Get Session Info command failed"); lprintf(LOG_ERR, "Get Session Info command failed");
retval = -1; retval = -1;
} }
else if (rsp->ccode > 0) else if (rsp->ccode)
{ {
lprintf(LOG_ERR, "Get Session Info command failed: %s", lprintf(LOG_ERR, "Get Session Info command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
@ -328,7 +328,7 @@ ipmi_get_session_info(struct ipmi_intf * intf,
retval = -1; retval = -1;
break; break;
} }
else if (rsp->ccode > 0 && rsp->ccode != 0xCC && rsp->ccode != 0xCB) else if (rsp->ccode && rsp->ccode != 0xCC && rsp->ccode != 0xCB)
{ {
lprintf(LOG_ERR, "Get Session Info command failed: %s", lprintf(LOG_ERR, "Get Session Info command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));

View File

@ -129,7 +129,7 @@ ipmi_sol_payload_access(struct ipmi_intf * intf, uint8_t channel,
lprintf(LOG_ERR, "Error %sabling SOL payload for user %d on channel %d", lprintf(LOG_ERR, "Error %sabling SOL payload for user %d on channel %d",
enable ? "en" : "dis", userid, channel); enable ? "en" : "dis", userid, channel);
rc = (-1); rc = (-1);
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error %sabling SOL payload for user %d on channel %d: %s", lprintf(LOG_ERR, "Error %sabling SOL payload for user %d on channel %d: %s",
enable ? "en" : "dis", userid, channel, enable ? "en" : "dis", userid, channel,
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
@ -1074,7 +1074,7 @@ ipmi_sol_set_param(struct ipmi_intf * intf,
} }
if (!(!strncmp(param, "set-in-progress", 15) && !strncmp(value, "commit-write", 12)) && if (!(!strncmp(param, "set-in-progress", 15) && !strncmp(value, "commit-write", 12)) &&
rsp->ccode > 0) { rsp->ccode) {
switch (rsp->ccode) { switch (rsp->ccode) {
case 0x80: case 0x80:
lprintf(LOG_ERR, "Error setting SOL parameter '%s': " lprintf(LOG_ERR, "Error setting SOL parameter '%s': "

View File

@ -285,7 +285,7 @@ sunoem_led_get(struct ipmi_intf * intf, struct sdr_record_generic_locator * dev,
if (rsp == NULL) { if (rsp == NULL) {
*loc_rsp = NULL; *loc_rsp = NULL;
return (SUNOEM_EC_BMC_NOT_RESPONDING); return (SUNOEM_EC_BMC_NOT_RESPONDING);
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
*loc_rsp = rsp; *loc_rsp = rsp;
return (SUNOEM_EC_BMC_CCODE_NONZERO); return (SUNOEM_EC_BMC_CCODE_NONZERO);
} else { } else {
@ -332,7 +332,7 @@ sunoem_led_set(struct ipmi_intf * intf, struct sdr_record_generic_locator * dev,
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "Sun OEM Set LED command failed."); lprintf(LOG_ERR, "Sun OEM Set LED command failed.");
return NULL; return NULL;
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Sun OEM Set LED command failed: %s", lprintf(LOG_ERR, "Sun OEM Set LED command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return NULL; return NULL;
@ -692,7 +692,7 @@ ipmi_sunoem_led_set(struct ipmi_intf * intf, int argc, char ** argv)
if (a->record.genloc->entity.logical) if (a->record.genloc->entity.logical)
continue; continue;
rsp = sunoem_led_set(intf, a->record.genloc, ledtype, ledmode); rsp = sunoem_led_set(intf, a->record.genloc, ledtype, ledmode);
if (rsp && rsp->ccode == 0) if (rsp && !rsp->ccode)
led_print((const char *) a->record.genloc->id_string, led_print((const char *) a->record.genloc->id_string,
PRINT_NORMAL, ledmode); PRINT_NORMAL, ledmode);
else else
@ -724,7 +724,7 @@ ipmi_sunoem_led_set(struct ipmi_intf * intf, int argc, char ** argv)
* handle physical entity * handle physical entity
*/ */
rsp = sunoem_led_set(intf, sdr->record.genloc, ledtype, ledmode); rsp = sunoem_led_set(intf, sdr->record.genloc, ledtype, ledmode);
if (rsp && rsp->ccode == 0) if (rsp && !rsp->ccode)
led_print(argv[0], PRINT_NORMAL, ledmode); led_print(argv[0], PRINT_NORMAL, ledmode);
else else
return (-1); return (-1);
@ -815,7 +815,7 @@ ipmi_sunoem_sshkey_del(struct ipmi_intf * intf, uint8_t uid)
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to delete ssh key for UID %d", uid); lprintf(LOG_ERR, "Unable to delete ssh key for UID %d", uid);
return (-1); return (-1);
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Unable to delete ssh key for UID %d: %s", uid, lprintf(LOG_ERR, "Unable to delete ssh key for UID %d: %s", uid,
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return (-1); return (-1);
@ -937,7 +937,7 @@ ipmi_sunoem_sshkey_set(struct ipmi_intf * intf, uint8_t uid, char * ifile)
return (-1); return (-1);
} /* if (rsp == NULL) */ } /* if (rsp == NULL) */
if (rsp->ccode != 0) { if (rsp->ccode) {
printf("failed\n"); printf("failed\n");
lprintf(LOG_ERR, "Unable to set ssh key for UID %d, %s.", uid, lprintf(LOG_ERR, "Unable to set ssh key for UID %d, %s.", uid,
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
@ -945,7 +945,7 @@ ipmi_sunoem_sshkey_set(struct ipmi_intf * intf, uint8_t uid, char * ifile)
fclose(fp); fclose(fp);
return (-1); return (-1);
} /* if (rsp->ccode != 0) */ }
} }
printf("done\n"); printf("done\n");
@ -1095,7 +1095,7 @@ ipmi_sunoem_cli(struct ipmi_intf * intf, int argc, char *argv[])
return (-1); return (-1);
} }
cli_rsp = (sunoem_cli_msg_t *) rsp->data; cli_rsp = (sunoem_cli_msg_t *) rsp->data;
if ((cli_rsp->command_response != 0) || (rsp->ccode != 0)) { if (cli_rsp->command_response || rsp->ccode) {
if (strncmp(cli_rsp->buf, SUNOEM_CLI_INVALID_VER_ERR, if (strncmp(cli_rsp->buf, SUNOEM_CLI_INVALID_VER_ERR,
sizeof(SUNOEM_CLI_INVALID_VER_ERR) - 1) == 0 sizeof(SUNOEM_CLI_INVALID_VER_ERR) - 1) == 0
|| strncmp(&(cli_rsp->buf[1]), SUNOEM_CLI_INVALID_VER_ERR, || strncmp(&(cli_rsp->buf[1]), SUNOEM_CLI_INVALID_VER_ERR,
@ -1154,7 +1154,7 @@ ipmi_sunoem_cli(struct ipmi_intf * intf, int argc, char *argv[])
return (-1); return (-1);
} }
} }
while (rsp->ccode == 0 && cli_rsp->command_response == 0) { while (!rsp->ccode && cli_rsp->command_response == 0) {
int rc = 0; int rc = 0;
int count = 0; int count = 0;
cli_req.buf[0] = '\0'; cli_req.buf[0] = '\0';
@ -1280,7 +1280,7 @@ ipmi_sunoem_cli(struct ipmi_intf * intf, int argc, char *argv[])
fflush(NULL); /* Flush partial lines to stdout */ fflush(NULL); /* Flush partial lines to stdout */
count = 0; /* Don't re-send the client's data */ count = 0; /* Don't re-send the client's data */
if (cli_req.command_response == SUNOEM_CLI_CMD_EOF if (cli_req.command_response == SUNOEM_CLI_CMD_EOF
&& cli_rsp->command_response != 0 && rsp->ccode == 0) { && cli_rsp->command_response != 0 && !rsp->ccode) {
cli_rsp->command_response = 1; cli_rsp->command_response = 1;
} }
} while (cli_rsp->command_response == 0 && cli_rsp->buf[0] != '\0'); } while (cli_rsp->command_response == 0 && cli_rsp->buf[0] != '\0');
@ -1380,7 +1380,7 @@ ipmi_sunoem_echo(struct ipmi_intf * intf, int argc, char *argv[])
gettimeofday(&end_time, NULL); gettimeofday(&end_time, NULL);
resp_time = ((end_time.tv_sec - start_time.tv_sec) * 1000) resp_time = ((end_time.tv_sec - start_time.tv_sec) * 1000)
+ ((end_time.tv_usec - start_time.tv_usec) / 1000); + ((end_time.tv_usec - start_time.tv_usec) / 1000);
if ((rsp == NULL) || (rsp->ccode != 0)) { if ((rsp == NULL) || rsp->ccode) {
lprintf(LOG_ERR, "Sun OEM echo command failed. Seq # %d", lprintf(LOG_ERR, "Sun OEM echo command failed. Seq # %d",
echo_req.seq_num); echo_req.seq_num);
rc = (-2); rc = (-2);
@ -1504,7 +1504,7 @@ ipmi_sunoem_getversion(struct ipmi_intf * intf,
lprintf(LOG_ERR, "Sun OEM Get SP Version Failed."); lprintf(LOG_ERR, "Sun OEM Get SP Version Failed.");
return (-1); return (-1);
} }
if (rsp->ccode != 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Sun OEM Get SP Version Failed: %d", rsp->ccode); lprintf(LOG_ERR, "Sun OEM Get SP Version Failed: %d", rsp->ccode);
return (-1); return (-1);
} }
@ -1654,7 +1654,7 @@ ipmi_sunoem_nacname(struct ipmi_intf * intf, int argc, char *argv[])
lprintf(LOG_ERR, "Sun OEM nacname command failed."); lprintf(LOG_ERR, "Sun OEM nacname command failed.");
return (-1); return (-1);
} }
if (rsp->ccode != 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Sun OEM nacname command failed: %d", rsp->ccode); lprintf(LOG_ERR, "Sun OEM nacname command failed: %d", rsp->ccode);
return (-1); return (-1);
} }
@ -1824,7 +1824,7 @@ ipmi_sunoem_getval(struct ipmi_intf * intf, int argc, char *argv[])
lprintf(LOG_ERR, "Sun OEM getval1 command failed."); lprintf(LOG_ERR, "Sun OEM getval1 command failed.");
return (-1); return (-1);
} }
if (rsp->ccode != 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Sun OEM getval1 command failed: %d", rsp->ccode); lprintf(LOG_ERR, "Sun OEM getval1 command failed: %d", rsp->ccode);
return (-1); return (-1);
} }
@ -1847,7 +1847,7 @@ ipmi_sunoem_getval(struct ipmi_intf * intf, int argc, char *argv[])
return (-1); return (-1);
} }
if (rsp->ccode != 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Sun OEM getval2 command failed: %d", rsp->ccode); lprintf(LOG_ERR, "Sun OEM getval2 command failed: %d", rsp->ccode);
return (-1); return (-1);
} }
@ -1915,7 +1915,7 @@ send_luapi_prop_name(struct ipmi_intf * intf, int len, char *prop_name,
return (-1); return (-1);
} }
if (rsp->ccode != 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Sun OEM setval prop name: request failed: %d", lprintf(LOG_ERR, "Sun OEM setval prop name: request failed: %d",
rsp->ccode); rsp->ccode);
return (-1); return (-1);
@ -1988,7 +1988,7 @@ send_luapi_prop_value(struct ipmi_intf * intf, int len, char *prop_value,
return (-1); return (-1);
} }
if (rsp->ccode != 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Sun OEM setval prop value: request failed: %d", lprintf(LOG_ERR, "Sun OEM setval prop value: request failed: %d",
rsp->ccode); rsp->ccode);
return (-1); return (-1);
@ -2081,7 +2081,7 @@ ipmi_sunoem_setval(struct ipmi_intf * intf, int argc, char *argv[])
return (-1); return (-1);
} }
if (rsp->ccode != 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Sun OEM setval command failed: %d", rsp->ccode); lprintf(LOG_ERR, "Sun OEM setval command failed: %d", rsp->ccode);
return (-1); return (-1);
} }
@ -2192,7 +2192,7 @@ ipmi_sunoem_getfile(struct ipmi_intf * intf, int argc, char *argv[])
fclose(fp); fclose(fp);
return (-1); return (-1);
} }
if (rsp->ccode != 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Sun OEM getfile command failed: %d", rsp->ccode); lprintf(LOG_ERR, "Sun OEM getfile command failed: %d", rsp->ccode);
fclose(fp); fclose(fp);
return (-1); return (-1);
@ -2305,7 +2305,7 @@ ipmi_sunoem_getbehavior(struct ipmi_intf * intf, int argc, char *argv[])
return (-1); return (-1);
} }
if (rsp->ccode != 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Sun OEM getbehavior command failed: %d", rsp->ccode); lprintf(LOG_ERR, "Sun OEM getbehavior command failed: %d", rsp->ccode);
return (-1); return (-1);
} }

View File

@ -107,7 +107,7 @@ ipmi_tsol_command(struct ipmi_intf *intf, char *recvip, int port,
lprintf(LOG_ERR, "Unable to perform TSOL command"); lprintf(LOG_ERR, "Unable to perform TSOL command");
return (-1); return (-1);
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Unable to perform TSOL command: %s", lprintf(LOG_ERR, "Unable to perform TSOL command: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return (-1); return (-1);
@ -152,7 +152,7 @@ ipmi_tsol_send_keystroke(struct ipmi_intf *intf, char *buff, int length)
lprintf(LOG_ERR, "Unable to send keystroke"); lprintf(LOG_ERR, "Unable to send keystroke");
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Unable to send keystroke: %s", lprintf(LOG_ERR, "Unable to send keystroke: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;

View File

@ -80,7 +80,7 @@ _ipmi_get_user_access(struct ipmi_intf *intf,
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) { if (rsp == NULL) {
return (-1); return (-1);
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
return rsp->ccode; return rsp->ccode;
} else if (rsp->data_len != 4) { } else if (rsp->data_len != 4) {
return (-2); return (-2);
@ -121,7 +121,7 @@ _ipmi_get_user_name(struct ipmi_intf *intf, struct user_name_t *user_name_ptr)
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) { if (rsp == NULL) {
return (-1); return (-1);
} else if (rsp->ccode > 0) { } else if (rsp->ccode) {
return rsp->ccode; return rsp->ccode;
} else if (rsp->data_len != 16) { } else if (rsp->data_len != 16) {
return (-2); return (-2);
@ -380,7 +380,7 @@ ipmi_user_set_username(
user_id, name); user_id, name);
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Set User Name command failed (user %d, name %s): %s", lprintf(LOG_ERR, "Set User Name command failed (user %d, name %s): %s",
user_id, name, val2str(rsp->ccode, completion_code_vals)); user_id, name, val2str(rsp->ccode, completion_code_vals));
return -1; return -1;

View File

@ -198,7 +198,7 @@ vita_discover(struct ipmi_intf *intf)
} else if (rsp->ccode == 0xCC) { } else if (rsp->ccode == 0xCC) {
lprintf(LOG_INFO, "Invalid data field received: %s", lprintf(LOG_INFO, "Invalid data field received: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
lprintf(LOG_INFO, "Invalid completion code received: %s", lprintf(LOG_INFO, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
} else if (rsp->data_len < 5) { } else if (rsp->data_len < 5) {
@ -242,7 +242,7 @@ ipmi_vita_ipmb_address(struct ipmi_intf *intf)
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "No valid response received"); lprintf(LOG_ERR, "No valid response received");
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Invalid completion code received: %s", lprintf(LOG_ERR, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
} else if (rsp->data_len < 7) { } else if (rsp->data_len < 7) {
@ -287,7 +287,7 @@ ipmi_vita_getaddr(struct ipmi_intf *intf, int argc, char **argv)
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "No valid response received"); lprintf(LOG_ERR, "No valid response received");
return -1; return -1;
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Invalid completion code received: %s", lprintf(LOG_ERR, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -335,7 +335,7 @@ ipmi_vita_get_vso_capabilities(struct ipmi_intf *intf)
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "No valid response received."); lprintf(LOG_ERR, "No valid response received.");
return -1; return -1;
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Invalid completion code received: %s", lprintf(LOG_ERR, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -405,7 +405,7 @@ ipmi_vita_set_fru_activation(struct ipmi_intf *intf,
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "No valid response received."); lprintf(LOG_ERR, "No valid response received.");
return -1; return -1;
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Invalid completion code received: %s", lprintf(LOG_ERR, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -447,7 +447,7 @@ ipmi_vita_get_fru_state_policy_bits(struct ipmi_intf *intf, char **argv)
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "No valid response received."); lprintf(LOG_ERR, "No valid response received.");
return -1; return -1;
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Invalid completion code received: %s", lprintf(LOG_ERR, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -502,7 +502,7 @@ ipmi_vita_set_fru_state_policy_bits(struct ipmi_intf *intf, char **argv)
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "No valid response received."); lprintf(LOG_ERR, "No valid response received.");
return -1; return -1;
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Invalid completion code received: %s", lprintf(LOG_ERR, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -543,7 +543,7 @@ ipmi_vita_get_led_properties(struct ipmi_intf *intf, char **argv)
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "No valid response received."); lprintf(LOG_ERR, "No valid response received.");
return -1; return -1;
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Invalid completion code received: %s", lprintf(LOG_ERR, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -588,7 +588,7 @@ ipmi_vita_get_led_color_capabilities(struct ipmi_intf *intf, char **argv)
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "No valid response received."); lprintf(LOG_ERR, "No valid response received.");
return -1; return -1;
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Invalid completion code received: %s", lprintf(LOG_ERR, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -652,7 +652,7 @@ ipmi_vita_get_led_state(struct ipmi_intf *intf, char **argv)
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "No valid response received."); lprintf(LOG_ERR, "No valid response received.");
return -1; return -1;
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Invalid completion code received: %s", lprintf(LOG_ERR, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -752,7 +752,7 @@ ipmi_vita_set_led_state(struct ipmi_intf *intf, char **argv)
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "No valid response received."); lprintf(LOG_ERR, "No valid response received.");
return -1; return -1;
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Invalid completion code received: %s", lprintf(LOG_ERR, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -799,7 +799,7 @@ ipmi_vita_fru_control(struct ipmi_intf *intf, char **argv)
if (rsp == NULL) { if (rsp == NULL) {
lprintf(LOG_ERR, "No valid response received."); lprintf(LOG_ERR, "No valid response received.");
return -1; return -1;
} else if (rsp->ccode != 0) { } else if (rsp->ccode) {
lprintf(LOG_ERR, "Invalid completion code received: %s", lprintf(LOG_ERR, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;

View File

@ -366,7 +366,7 @@ openipmi_enable_event_msg_buffer(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Get BMC Global Enables command failed"); lprintf(LOG_ERR, "Get BMC Global Enables command failed");
return -1; return -1;
} }
else if (rsp->ccode > 0) { else if (rsp->ccode) {
lprintf(LOG_ERR, "Get BMC Global Enables command failed: %s", lprintf(LOG_ERR, "Get BMC Global Enables command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -382,7 +382,7 @@ openipmi_enable_event_msg_buffer(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Set BMC Global Enables command failed"); lprintf(LOG_ERR, "Set BMC Global Enables command failed");
return -1; return -1;
} }
else if (rsp->ccode > 0) { else if (rsp->ccode) {
lprintf(LOG_ERR, "Set BMC Global Enables command failed: %s", lprintf(LOG_ERR, "Set BMC Global Enables command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -511,7 +511,7 @@ selwatch_get_data(struct ipmi_intf * intf, struct sel_data *data)
lprintf(LOG_ERR, "Get SEL Info command failed"); lprintf(LOG_ERR, "Get SEL Info command failed");
return 0; return 0;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Get SEL Info command failed: %s", lprintf(LOG_ERR, "Get SEL Info command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return 0; return 0;

View File

@ -1527,7 +1527,7 @@ ipmi_lan_keepalive(struct ipmi_intf * intf)
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) if (rsp == NULL)
return -1; return -1;
if (rsp->ccode > 0) if (rsp->ccode)
return -1; return -1;
return 0; return 0;
@ -1562,7 +1562,7 @@ ipmi_get_auth_capabilities_cmd(struct ipmi_intf * intf)
if (verbose > 2) if (verbose > 2)
printbuf(rsp->data, rsp->data_len, "get_auth_capabilities"); printbuf(rsp->data, rsp->data_len, "get_auth_capabilities");
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_INFO, "Get Auth Capabilities command failed: %s", lprintf(LOG_INFO, "Get Auth Capabilities command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -1677,7 +1677,7 @@ ipmi_get_session_challenge_cmd(struct ipmi_intf * intf)
if (verbose > 2) if (verbose > 2)
printbuf(rsp->data, rsp->data_len, "get_session_challenge"); printbuf(rsp->data, rsp->data_len, "get_session_challenge");
if (rsp->ccode > 0) { if (rsp->ccode) {
switch (rsp->ccode) { switch (rsp->ccode) {
case 0x81: case 0x81:
lprintf(LOG_ERR, "Invalid user name"); lprintf(LOG_ERR, "Invalid user name");
@ -1844,7 +1844,7 @@ ipmi_set_session_privlvl_cmd(struct ipmi_intf * intf)
if (verbose > 2) if (verbose > 2)
printbuf(rsp->data, rsp->data_len, "set_session_privlvl"); printbuf(rsp->data, rsp->data_len, "set_session_privlvl");
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Set Session Privilege Level to %s failed: %s", lprintf(LOG_ERR, "Set Session Privilege Level to %s failed: %s",
val2str(privlvl, ipmi_privlvl_vals), val2str(privlvl, ipmi_privlvl_vals),
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
@ -1892,7 +1892,7 @@ ipmi_close_session_cmd(struct ipmi_intf * intf)
"session ID %08lx", (long)session_id); "session ID %08lx", (long)session_id);
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Close Session command failed: %s", lprintf(LOG_ERR, "Close Session command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;

View File

@ -2718,7 +2718,7 @@ ipmi_get_auth_capabilities_cmd(
rsp = intf->sendrecv(intf, &req); rsp = intf->sendrecv(intf, &req);
if (rsp == NULL || rsp->ccode > 0) { if (rsp == NULL || rsp->ccode) {
/* /*
* It's very possible that this failed because we asked for IPMI * It's very possible that this failed because we asked for IPMI
* v2 data. Ask again, without requesting IPMI v2 data. * v2 data. Ask again, without requesting IPMI v2 data.
@ -2731,7 +2731,7 @@ ipmi_get_auth_capabilities_cmd(
lprintf(LOG_INFO, "Get Auth Capabilities error"); lprintf(LOG_INFO, "Get Auth Capabilities error");
return 1; return 1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_INFO, "Get Auth Capabilities error: %s", lprintf(LOG_INFO, "Get Auth Capabilities error: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return 1; return 1;
@ -2790,7 +2790,7 @@ ipmi_close_session_cmd(struct ipmi_intf * intf)
(long)intf->session->v2_data.bmc_id); (long)intf->session->v2_data.bmc_id);
return -1; return -1;
} }
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Close Session command failed: %s", lprintf(LOG_ERR, "Close Session command failed: %s",
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
return -1; return -1;
@ -3365,7 +3365,7 @@ ipmi_set_session_privlvl_cmd(struct ipmi_intf * intf)
if (verbose > 2) if (verbose > 2)
printbuf(rsp->data, rsp->data_len, "set_session_privlvl"); printbuf(rsp->data, rsp->data_len, "set_session_privlvl");
if (rsp->ccode > 0) { if (rsp->ccode) {
lprintf(LOG_ERR, "Set Session Privilege Level to %s failed: %s", lprintf(LOG_ERR, "Set Session Privilege Level to %s failed: %s",
val2str(privlvl, ipmi_privlvl_vals), val2str(privlvl, ipmi_privlvl_vals),
val2str(rsp->ccode, completion_code_vals)); val2str(rsp->ccode, completion_code_vals));
@ -3641,7 +3641,7 @@ ipmi_lanplus_keepalive(struct ipmi_intf * intf)
if (rsp == NULL) if (rsp == NULL)
return -1; return -1;
if (rsp->ccode > 0) if (rsp->ccode)
return -1; return -1;
return 0; return 0;

View File

@ -425,7 +425,7 @@ ipmi_openipmi_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
rsp.data_len = recv.msg.data_len - 1; rsp.data_len = recv.msg.data_len - 1;
/* save response data for caller */ /* save response data for caller */
if (rsp.ccode == 0 && rsp.data_len > 0) { if (!rsp.ccode && rsp.data_len > 0) {
memmove(rsp.data, rsp.data + 1, rsp.data_len); memmove(rsp.data, rsp.data + 1, rsp.data_len);
rsp.data[rsp.data_len] = 0; rsp.data[rsp.data_len] = 0;
} }

View File

@ -603,7 +603,7 @@ ipmi_usb_send_cmd(struct ipmi_intf *intf, struct ipmi_rq *req)
rsp.ccode = rsp.data[0]; rsp.ccode = rsp.data[0];
/* Save response data for caller */ /* Save response data for caller */
if ((rsp.ccode == 0) && (rsp.data_len > 0)) { if (!rsp.ccode && rsp.data_len > 0) {
memmove(rsp.data, rsp.data + 1, rsp.data_len - 1); memmove(rsp.data, rsp.data + 1, rsp.data_len - 1);
rsp.data[rsp.data_len] = 0; rsp.data[rsp.data_len] = 0;
rsp.data_len -= 1; rsp.data_len -= 1;