summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/dimm_spd.c4
-rw-r--r--lib/helper.c4
-rw-r--r--lib/ipmi_channel.c19
-rw-r--r--lib/ipmi_chassis.c22
-rwxr-xr-xlib/ipmi_dcmi.c4
-rw-r--r--lib/ipmi_delloem.c54
-rw-r--r--lib/ipmi_event.c8
-rw-r--r--lib/ipmi_firewall.c26
-rw-r--r--lib/ipmi_fru.c32
-rw-r--r--lib/ipmi_fwum.c10
-rw-r--r--lib/ipmi_hpmfwupg.c14
-rwxr-xr-xlib/ipmi_ime.c18
-rw-r--r--lib/ipmi_isol.c10
-rw-r--r--lib/ipmi_kontronoem.c16
-rw-r--r--lib/ipmi_lanp.c14
-rw-r--r--lib/ipmi_mc.c14
-rw-r--r--lib/ipmi_pef.c18
-rw-r--r--lib/ipmi_picmg.c4
-rw-r--r--lib/ipmi_raw.c4
-rw-r--r--lib/ipmi_sdr.c16
-rw-r--r--lib/ipmi_sdradd.c2
-rw-r--r--lib/ipmi_sel.c32
-rw-r--r--lib/ipmi_sensor.c6
-rw-r--r--lib/ipmi_session.c4
-rw-r--r--lib/ipmi_sol.c4
-rw-r--r--lib/ipmi_sunoem.c40
-rw-r--r--lib/ipmi_tsol.c4
-rw-r--r--lib/ipmi_user.c6
-rw-r--r--lib/ipmi_vita.c24
29 files changed, 216 insertions, 217 deletions
diff --git a/lib/dimm_spd.c b/lib/dimm_spd.c
index 41e30db..4ce9412 100644
--- a/lib/dimm_spd.c
+++ b/lib/dimm_spd.c
@@ -1636,7 +1636,7 @@ ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id)
printf(" Device not present (No Response)\n");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -1683,7 +1683,7 @@ ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id)
spd_data = NULL;
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
diff --git a/lib/helper.c b/lib/helper.c
index 7cecc17..bef85fd 100644
--- a/lib/helper.c
+++ b/lib/helper.c
@@ -888,7 +888,7 @@ ipmi_start_daemon(struct ipmi_intf *intf)
int
eval_ccode(const int ccode)
{
- if (ccode == 0) {
+ if (!ccode) {
return 0;
} else if (ccode < 0) {
switch (ccode) {
@@ -1052,7 +1052,7 @@ ipmi_get_oem_id(struct ipmi_intf *intf)
lprintf(LOG_ERR, "Get Board ID command failed");
return 0;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Get Board ID command failed: %#x %s",
rsp->ccode, val2str(rsp->ccode, completion_code_vals));
return 0;
diff --git a/lib/ipmi_channel.c b/lib/ipmi_channel.c
index 16eefe1..74e49bb 100644
--- a/lib/ipmi_channel.c
+++ b/lib/ipmi_channel.c
@@ -89,7 +89,7 @@ _ipmi_get_channel_access(struct ipmi_intf *intf,
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
return (-1);
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
return rsp->ccode;
} else if (rsp->data_len != 2) {
return (-2);
@@ -130,7 +130,7 @@ _ipmi_get_channel_info(struct ipmi_intf *intf,
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
return (-1);
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
return rsp->ccode;
} else if (rsp->data_len != 9) {
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);
- if ((rsp == NULL) || (rsp->ccode > 0)) {
+ if (!rsp || rsp->ccode) {
/*
* It's very possible that this failed because we asked for 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");
return (-1);
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Get Channel Authentication Capabilities failed: %s",
val2str(rsp->ccode, completion_code_vals));
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");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Get Channel Cipher Suites failed: %s",
val2str(rsp->ccode, completion_code_vals));
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");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Get Channel Cipher Suites failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -648,8 +648,9 @@ ipmi_get_channel_info(struct ipmi_intf *intf, uint8_t channel)
*
* @channel - IPMI Channel
*
- * returns - IPMI Channel Medium, IPMI_CHANNEL_MEDIUM_RESERVED if ccode > 0,
- * 0 on error.
+ * @returns IPMI Channel Medium
+ * @retval IPMI_CHANNEL_MEDIUM_RESERVED if ccode was not IPMI_CC_OK
+ * @retval 0 on error
*/
uint8_t
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;
} else if (ccode < 0 && eval_ccode(ccode) != 0) {
return 0;
- } else if (ccode > 0) {
+ } else if (ccode) {
lprintf(LOG_ERR, "Get Channel Info command failed: %s",
val2str(ccode, completion_code_vals));
return IPMI_CHANNEL_MEDIUM_RESERVED;
diff --git a/lib/ipmi_chassis.c b/lib/ipmi_chassis.c
index a78f295..1684ff9 100644
--- a/lib/ipmi_chassis.c
+++ b/lib/ipmi_chassis.c
@@ -61,7 +61,7 @@ ipmi_chassis_power_status(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Unable to get Chassis Power Status");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Get Chassis Power Status failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -101,7 +101,7 @@ ipmi_chassis_power_control(struct ipmi_intf * intf, uint8_t ctl)
val2str(ctl, ipmi_chassis_power_control_vals));
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Set Chassis Power Control to %s failed: %s",
val2str(ctl, ipmi_chassis_power_control_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");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Set Chassis Identify failed: %s",
val2str(rsp->ccode, completion_code_vals));
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");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Get Chassis Power-On-Hours failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -247,7 +247,7 @@ ipmi_chassis_restart_cause(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Unable to get Chassis Restart Cause");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Get Chassis Restart Cause failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -308,7 +308,7 @@ ipmi_chassis_status(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Error sending Chassis Status command");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Error sending Chassis Status command: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -391,7 +391,7 @@ ipmi_chassis_selftest(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Error sending Get Self Test command");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Error sending Get Self Test command: %s",
val2str(rsp->ccode, completion_code_vals));
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);
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
if (param != 0) {
lprintf(LOG_ERR, "Set Chassis Boot Parameter %d failed: %s",
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);
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Get Chassis Boot Parameter %s failed: %s",
arg, val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -855,7 +855,7 @@ ipmi_chassis_get_bootvalid(struct ipmi_intf * intf)
"Error Getting Chassis Boot Parameter %d", param_id);
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Get Chassis Boot Parameter %d failed: %s",
param_id, val2str(rsp->ccode, completion_code_vals));
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");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Power Restore Policy command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
diff --git a/lib/ipmi_dcmi.c b/lib/ipmi_dcmi.c
index 54ec902..8868461 100755
--- a/lib/ipmi_dcmi.c
+++ b/lib/ipmi_dcmi.c
@@ -707,7 +707,7 @@ chk_rsp(struct ipmi_rs * rsp)
lprintf(LOG_ERR, "\n DCMI request failed because: %s (%x)",
val2str(rsp->ccode, dcmi_ccode_vals), rsp->ccode);
return 1;
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "\n DCMI request failed because: %s (%x)",
val2str(rsp->ccode, completion_code_vals), rsp->ccode);
return 1;
@@ -742,7 +742,7 @@ chk_nm_rsp(struct ipmi_rs * rsp)
lprintf(LOG_ERR, "\n NM request failed because: %s (%x)",
val2str(rsp->ccode, nm_ccode_vals), rsp->ccode);
return 1;
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "\n NM request failed because: %s (%x)",
val2str(rsp->ccode, completion_code_vals), rsp->ccode);
return 1;
diff --git a/lib/ipmi_delloem.c b/lib/ipmi_delloem.c
index fe7fa35..dbb345f 100644
--- a/lib/ipmi_delloem.c
+++ b/lib/ipmi_delloem.c
@@ -1211,7 +1211,7 @@ ipmi_lcd_set_kvm(struct ipmi_intf * intf, char status)
lprintf(LOG_ERR, "Error getting LCD status: "
"Command not supported on this system.");
return -1;
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error setting LCD status: %s",
val2str(rsp->ccode, completion_code_vals));
rc= -1;
@@ -1257,7 +1257,7 @@ ipmi_lcd_set_lock(struct ipmi_intf * intf, char lock)
lprintf(LOG_ERR, "Error getting LCD status: "
"Command not supported on this system.");
rc = -1;
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error setting LCD status: %s",
val2str(rsp->ccode, completion_code_vals));
rc= -1;
@@ -1598,7 +1598,7 @@ ipmi_macinfo_drac_idrac_virtual_mac(struct ipmi_intf* intf,uint8_t NicNum)
if (rsp == NULL) {
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
return -1;
}
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");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Error in getting MAC Address (%s)",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -1760,7 +1760,7 @@ ipmi_macinfo_10g(struct ipmi_intf* intf, uint8_t NicNum)
lprintf(LOG_ERR, "Error in getting MAC Address");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Error in getting MAC Address (%s)",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -1834,7 +1834,7 @@ ipmi_macinfo_11g(struct ipmi_intf* intf, uint8_t NicNum)
lprintf(LOG_ERR, "Error in getting MAC Address");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Error in getting MAC Address (%s)",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -1865,7 +1865,7 @@ ipmi_macinfo_11g(struct ipmi_intf* intf, uint8_t NicNum)
lprintf(LOG_ERR, "Error in getting MAC Address");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Error in getting MAC Address (%s)",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -2056,7 +2056,7 @@ get_nic_selection_mode_12g(struct ipmi_intf* intf,int current_arg,
if (rsp == NULL) {
lprintf(LOG_ERR, "Error in getting nic selection");
return -1;
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error in getting nic selection (%s)",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -2278,7 +2278,7 @@ ipmi_lan_set_nic_selection_12g(struct ipmi_intf * intf, uint8_t * nic_selection)
lprintf(LOG_ERR,
"FM001 : A required license is missing or expired");
return -1;
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error in setting nic selection (%s)",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -2306,7 +2306,7 @@ ipmi_lan_set_nic_selection(struct ipmi_intf * intf, uint8_t nic_selection)
if (rsp == NULL) {
lprintf(LOG_ERR, "Error in setting nic selection");
return -1;
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error in setting nic selection (%s)",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -2339,7 +2339,7 @@ ipmi_lan_get_nic_selection(struct ipmi_intf * intf)
if (rsp == NULL) {
lprintf(LOG_ERR, "Error in getting nic selection");
return -1;
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error in getting nic selection (%s)",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -2395,7 +2395,7 @@ ipmi_lan_get_active_nic(struct ipmi_intf * intf)
if (rsp == NULL) {
lprintf(LOG_ERR, "Error in getting Active LOM Status");
return -1;
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error in getting Active LOM Status (%s)",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -2414,7 +2414,7 @@ ipmi_lan_get_active_nic(struct ipmi_intf * intf)
if (rsp == NULL) {
lprintf(LOG_ERR, "Error in getting Active LOM Status");
return -1;
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error in getting Active LOM Status (%s)",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -2652,12 +2652,12 @@ ipmi_get_sensor_reading(struct ipmi_intf *intf, unsigned char sensorNumber,
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
return 1;
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
return 1;
}
memcpy(pSensorReadingData, rsp->data, sizeof(SensorReadingType));
/* if there is an error transmitting ipmi command, return error */
- if (rsp->ccode != 0) {
+ if (rsp->ccode) {
rc = 1;
}
/* if sensor messages are disabled, return error*/
@@ -2697,7 +2697,7 @@ ipmi_get_power_capstatus_command(struct ipmi_intf * intf)
lprintf(LOG_ERR,
"FM001 : A required license is missing or expired");
return -1; /* Return Error as unlicensed */
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error getting powercap statusr: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -2748,7 +2748,7 @@ ipmi_set_power_capstatus_command(struct ipmi_intf * intf, uint8_t val)
lprintf(LOG_ERR,
"FM001 : A required license is missing or expired");
return -1; /* return unlicensed Error code */
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error setting powercap statusr: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -2803,7 +2803,7 @@ ipmi_powermgmt(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Error getting BMC time info.");
return -1;
}
- if (rsp->ccode != 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR,
"Error getting power management information, return code %x",
rsp->ccode);
@@ -2841,7 +2841,7 @@ ipmi_powermgmt(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Error getting power management information: "
"Command not supported on this system.");
return -1;
- }else if (rsp->ccode != 0) {
+ }else if (rsp->ccode) {
lprintf(LOG_ERR,
"Error getting power management information, return code %x",
rsp->ccode);
@@ -2944,7 +2944,7 @@ ipmi_powermgmt_clear(struct ipmi_intf * intf, uint8_t clearValue)
lprintf(LOG_ERR,
"Error clearing power values, command not supported on this system.");
return -1;
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error clearing power values: %s",
val2str(rsp->ccode, completion_code_vals));
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: "
"Command not supported on this system ");
return -1;
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error getting power headroom status: %s",
val2str(rsp->ccode, completion_code_vals));
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.lun,
sdr->record.common->keys.channel);
- if (rsp == NULL || rsp->ccode != 0) {
+ if (rsp == NULL || rsp->ccode) {
lprintf(LOG_ERR,
"Error : Can not access the System Level sensor data");
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: "
"Command not supported on this system.");
return -1;
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error getting instantaneous power consumption data: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -3874,7 +3874,7 @@ ipmi_get_sd_card_info(struct ipmi_intf * intf) {
if (rsp == NULL) {
lprintf(LOG_ERR, "Error in getting SD Card Extended Information");
return -1;
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error in getting SD Card Extended Information (%s)",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -4052,7 +4052,7 @@ CheckSetLEDSupport(struct ipmi_intf * intf)
data[9] = 0x00;
rsp = intf->sendrecv(intf, &req);
- if (rsp == NULL || rsp->ccode != 0) {
+ if (rsp == NULL || rsp->ccode) {
return;
}
SetLEDSupported = 1;
@@ -4097,7 +4097,7 @@ ipmi_getdrivemap(struct ipmi_intf * intf, int b, int d, int f, int *bay,
if (rsp == NULL) {
lprintf(LOG_ERR, "Error issuing getdrivemap command.");
return -1;
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error issuing getdrivemap command: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -4152,7 +4152,7 @@ ipmi_setled_state(struct ipmi_intf * intf, int bayId, int slotId, int state)
if (rsp == NULL) {
lprintf(LOG_ERR, "Error issuing setled command.");
return -1;
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error issuing setled command: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
diff --git a/lib/ipmi_event.c b/lib/ipmi_event.c
index d1e2860..799fa32 100644
--- a/lib/ipmi_event.c
+++ b/lib/ipmi_event.c
@@ -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");
return -1;
}
- else if (rsp->ccode > 0) {
+ else if (rsp->ccode) {
lprintf(LOG_ERR, "Platform Event Message command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -352,7 +352,7 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
lprintf(LOG_ERR,
"Command Get Sensor Thresholds failed: invalid response.");
return (-1);
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Command Get Sensor Thresholds failed: %s",
val2str(rsp->ccode, completion_code_vals));
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,
target, lun, channel);
- if (rsp != NULL && rsp->ccode == 0)
+ if (rsp != NULL && !rsp->ccode)
off = dir ? rsp->data[0] : rsp->data[1];
if (off <= 0)
off = 1;
@@ -578,7 +578,7 @@ ipmi_event_fromfile(struct ipmi_intf * intf, char * file)
lprintf(LOG_ERR, "Platform Event Message command failed");
rc = -1;
}
- else if (rsp->ccode > 0) {
+ else if (rsp->ccode) {
lprintf(LOG_ERR, "Platform Event Message command failed: %s",
val2str(rsp->ccode, completion_code_vals));
rc = -1;
diff --git a/lib/ipmi_firewall.c b/lib/ipmi_firewall.c
index 20d566d..e2398c2 100644
--- a/lib/ipmi_firewall.c
+++ b/lib/ipmi_firewall.c
@@ -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");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Get NetFn Support command failed: %s",
val2str(rsp->ccode, completion_code_vals));
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);
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
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));
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);
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
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));
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);
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
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));
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);
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
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));
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);
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
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));
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);
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
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));
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);
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
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));
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);
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
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));
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);
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",
p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals));
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);
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",
p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals));
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);
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",
p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals));
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);
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",
p->lun, p->netfn, p->command, val2str(rsp->ccode, completion_code_vals));
return -1;
diff --git a/lib/ipmi_fru.c b/lib/ipmi_fru.c
index 05626bb..a41a256 100644
--- a/lib/ipmi_fru.c
+++ b/lib/ipmi_fru.c
@@ -276,7 +276,7 @@ build_fru_bloc(struct ipmi_intf * intf, struct fru_info *fru, uint8_t id)
return NULL;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR," Device not present (%s)",
val2str(rsp->ccode, completion_code_vals));
return NULL;
@@ -567,7 +567,7 @@ write_fru_area(struct ipmi_intf * intf, struct fru_info *fru, uint8_t id,
protected_bloc = 1;
}
- if (rsp->ccode > 0)
+ if (rsp->ccode)
break;
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");
break;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
/* if we get C7h or C8h or CAh return code then we requested too
* many bytes at once so try again with smaller size */
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");
break;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
/* if we get C7 or C8 or CA return code then we requested too
* many bytes at once so try again with smaller size */
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");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -2932,7 +2932,7 @@ __ipmi_fru_print(struct ipmi_intf * intf, uint8_t id)
printf(" Device not present (No Response)\n");
return 1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
return 1;
@@ -3111,7 +3111,7 @@ ipmi_fru_print_all(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Get Device ID command failed");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Get Device ID command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -3230,7 +3230,7 @@ ipmi_fru_read_to_bin(struct ipmi_intf * intf,
if (!rsp)
return;
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
if (rsp->ccode == 0xc3)
printf (" Timeout accessing FRU info. (Device not present?)\n");
return;
@@ -3421,7 +3421,7 @@ ipmi_fru_edit_multirec(struct ipmi_intf * intf, uint8_t id ,
printf(" Device not present (No Response)\n");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -3626,7 +3626,7 @@ ipmi_fru_get_multirec(struct ipmi_intf * intf, uint8_t id ,
printf(" Device not present (No Response)\n");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -3977,7 +3977,7 @@ ipmi_fru_get_multirec_location_from_fru(struct ipmi_intf * intf,
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
if (rsp->ccode == 0xc3)
printf (" Timeout accessing FRU info. (Device not present?)\n");
else
@@ -4009,7 +4009,7 @@ ipmi_fru_get_multirec_location_from_fru(struct ipmi_intf * intf,
if (!rsp)
return -1;
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
if (rsp->ccode == 0xc3)
printf (" Timeout while reading FRU data. (Device not present?)\n");
return -1;
@@ -4095,7 +4095,7 @@ ipmi_fru_get_internal_use_info( struct ipmi_intf * intf,
printf(" Device not present (No Response)\n");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -4131,7 +4131,7 @@ ipmi_fru_get_internal_use_info( struct ipmi_intf * intf,
printf(" Device not present (No Response)\n");
return 1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
return 1;
@@ -4678,7 +4678,7 @@ f_type, uint8_t f_index, char *f_string)
rc = (-1);
goto ipmi_fru_set_field_string_out;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
rc = (-1);
@@ -4715,7 +4715,7 @@ f_type, uint8_t f_index, char *f_string)
rc = (-1);
goto ipmi_fru_set_field_string_out;
}
- if (rsp->ccode > 0)
+ if (rsp->ccode)
{
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
diff --git a/lib/ipmi_fwum.c b/lib/ipmi_fwum.c
index 84c2e98..2b1f233 100644
--- a/lib/ipmi_fwum.c
+++ b/lib/ipmi_fwum.c
@@ -454,7 +454,7 @@ KfwumGetInfo(struct ipmi_intf *intf, unsigned char output,
if (!rsp) {
lprintf(LOG_ERR, "Error in FWUM Firmware Get Info Command.");
return (-1);
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "FWUM Firmware Get Info returned %x",
rsp->ccode);
return (-1);
@@ -552,7 +552,7 @@ KfwumGetDeviceInfo(struct ipmi_intf *intf, unsigned char output,
if (rsp == NULL) {
lprintf(LOG_ERR, "Error in Get Device Id Command");
return (-1);
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Get Device Id returned %x",
rsp->ccode);
return (-1);
@@ -671,7 +671,7 @@ KfwumManualRollback(struct ipmi_intf *intf)
if (rsp == NULL) {
lprintf(LOG_ERR, "Error in FWUM Manual Rollback Command.");
return (-1);
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR,
"Error in FWUM Manual Rollback Command returned %x",
rsp->ccode);
@@ -772,7 +772,7 @@ KfwumSaveFirmwareImage(struct ipmi_intf *intf, unsigned char sequenceNumber,
*pInBufLength = 0;
break;
} /* For other interface keep trying */
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
if (rsp->ccode == 0xc0) {
sleep(1);
} else if ((rsp->ccode == 0xc7)
@@ -838,7 +838,7 @@ KfwumFinishFirmwareImage(struct ipmi_intf *intf, tKFWUM_InFirmwareInfo firmInfo)
rsp = intf->sendrecv(intf, &req);
} while (rsp == NULL || rsp->ccode == 0xc0);
- if (rsp->ccode != 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR,
"FWUM Firmware Finish Firmware Image Download returned %x",
rsp->ccode);
diff --git a/lib/ipmi_hpmfwupg.c b/lib/ipmi_hpmfwupg.c
index 3d74f5f..fe9211e 100644
--- a/lib/ipmi_hpmfwupg.c
+++ b/lib/ipmi_hpmfwupg.c
@@ -1438,7 +1438,7 @@ HpmfwupgGetDeviceId(struct ipmi_intf *intf, struct ipm_devid_rsp *pGetDevId)
lprintf(LOG_ERR, "Error getting device ID.");
return HPMFWUPG_ERROR;
}
- if (rsp->ccode != 0x00) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Error getting device ID.");
lprintf(LOG_ERR, "compcode=0x%x: %s",
rsp->ccode,
@@ -1467,7 +1467,7 @@ HpmfwupgGetTargetUpgCapabilities(struct ipmi_intf *intf,
"Error getting target upgrade capabilities.");
return HPMFWUPG_ERROR;
}
- if (rsp->ccode != 0x00) {
+ if (rsp->ccode) {
lprintf(LOG_ERR,
"Error getting target upgrade capabilities, ccode: 0x%x: %s",
rsp->ccode,
@@ -1544,7 +1544,7 @@ HpmfwupgGetComponentProperties(struct ipmi_intf *intf,
"Error getting component properties\n");
return HPMFWUPG_ERROR;
}
- if (rsp->ccode != 0x00) {
+ if (rsp->ccode) {
lprintf(LOG_NOTICE,
"Error getting component properties");
lprintf(LOG_NOTICE,
@@ -1669,7 +1669,7 @@ HpmfwupgAbortUpgrade(struct ipmi_intf *intf,
lprintf(LOG_ERR, "Error - aborting upgrade.");
return HPMFWUPG_ERROR;
}
- if (rsp->ccode != 0x00) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Error aborting upgrade");
lprintf(LOG_ERR, "compcode=0x%x: %s",
rsp->ccode,
@@ -1701,7 +1701,7 @@ HpmfwupgInitiateUpgradeAction(struct ipmi_intf *intf,
/* Long duration command handling */
if (rsp->ccode == HPMFWUPG_COMMAND_IN_PROGRESS) {
rc = HpmfwupgWaitLongDurationCmd(intf, pFwupgCtx);
- } else if (rsp->ccode != 0x00) {
+ } else if (rsp->ccode) {
lprintf(LOG_NOTICE,"Error initiating upgrade action");
lprintf(LOG_NOTICE, "compcode=0x%x: %s",
rsp->ccode,
@@ -1764,7 +1764,7 @@ HpmfwupgUploadFirmwareBlock(struct ipmi_intf *intf,
/* Long duration command handling */
if (rsp->ccode == HPMFWUPG_COMMAND_IN_PROGRESS) {
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.
* This will be fixed in the next release of open ipmi and this
* check will have to be removed. (Buggy version = 39)
@@ -1954,7 +1954,7 @@ HpmfwupgManualFirmwareRollback(struct ipmi_intf *intf,
printf("Waiting firmware rollback...");
fflush(stdout);
rc = HpmfwupgQueryRollbackStatus(intf, &resCmd, &fwupgCtx);
- } else if ( rsp->ccode != 0x00 ) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Error sending manual rollback");
lprintf(LOG_ERR, "compcode=0x%x: %s",
rsp->ccode,
diff --git a/lib/ipmi_ime.c b/lib/ipmi_ime.c
index 081c3e0..5f726cd 100755
--- a/lib/ipmi_ime.c
+++ b/lib/ipmi_ime.c
@@ -206,7 +206,7 @@ static int ImeGetInfo(struct ipmi_intf *intf)
lprintf(LOG_ERR, "Get Device ID command failed");
return IME_ERROR;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Get Device ID command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return IME_ERROR;
@@ -513,7 +513,7 @@ static int ImeUpdatePrepare(struct ipmi_intf *intf)
lprintf(LOG_ERR, "UpdatePrepare command failed");
return IME_ERROR;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "UpdatePrepare command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return IME_ERROR;
@@ -548,7 +548,7 @@ static int ImeUpdateOpenArea(struct ipmi_intf *intf)
lprintf(LOG_ERR, "UpdateOpenArea command failed");
return IME_ERROR;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "UpdateOpenArea command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return IME_ERROR;
@@ -588,7 +588,7 @@ static int ImeUpdateWriteArea(
lprintf(LOG_ERR, "UpdateWriteArea command failed");
return IME_ERROR;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "UpdateWriteArea command failed: %s",
val2str(rsp->ccode, completion_code_vals));
if( rsp->ccode == 0x80) // restart operation
@@ -635,7 +635,7 @@ static int ImeUpdateCloseArea(
lprintf(LOG_ERR, "UpdateCloseArea command failed");
return IME_ERROR;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "UpdateCloseArea command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return IME_ERROR;
@@ -669,7 +669,7 @@ static int ImeUpdateGetStatus(struct ipmi_intf *intf, tImeStatus *pStatus )
lprintf(LOG_ERR, "UpdatePrepare command failed");
return IME_ERROR;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "UpdatePrepare command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return IME_ERROR;
@@ -742,7 +742,7 @@ static int ImeUpdateGetCapabilities(struct ipmi_intf *intf, tImeCaps *pCaps )
lprintf(LOG_ERR, "UpdatePrepare command failed");
return IME_ERROR;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "UpdatePrepare command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return IME_ERROR;
@@ -782,7 +782,7 @@ static int ImeUpdateRegisterUpdate(struct ipmi_intf *intf, tImeUpdateType type)
lprintf(LOG_ERR, "ImeUpdateRegisterUpdate command failed");
return IME_ERROR;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "ImeUpdateRegisterUpdate command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return IME_ERROR;
@@ -813,7 +813,7 @@ static int ImeUpdateShowStatus(struct ipmi_intf *intf)
lprintf(LOG_ERR, "UpdatePrepare command failed");
return IME_ERROR;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "UpdatePrepare command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return IME_ERROR;
diff --git a/lib/ipmi_isol.c b/lib/ipmi_isol.c
index 84d7db8..fa78010 100644
--- a/lib/ipmi_isol.c
+++ b/lib/ipmi_isol.c
@@ -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!");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Error in Get ISOL Config Command: %s",
val2str(rsp->ccode, completion_code_vals));
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");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Error in Get ISOL Config Command: %s",
val2str(rsp->ccode, completion_code_vals));
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");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Error in Get ISOL Config Command: %s",
val2str(rsp->ccode, completion_code_vals));
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);
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Error setting ISOL parameter '%s': %s",
param, val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -432,7 +432,7 @@ ipmi_isol_deactivate(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Error deactivating ISOL");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Error deactivating ISOL: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
diff --git a/lib/ipmi_kontronoem.c b/lib/ipmi_kontronoem.c
index e7f49cb..d27e99e 100644
--- a/lib/ipmi_kontronoem.c
+++ b/lib/ipmi_kontronoem.c
@@ -191,7 +191,7 @@ ipmi_kontronoem_send_set_large_buffer(struct ipmi_intf *intf,
if (rsp == NULL) {
printf("Cannot send large buffer command\n");
return(-1);
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
printf("Invalid length for the selected interface (%s) %d\n",
val2str(rsp->ccode, completion_code_vals), rsp->ccode);
return(-1);
@@ -246,7 +246,7 @@ ipmi_kontron_set_serial_number(struct ipmi_intf *intf)
if (rsp == NULL) {
printf(" Device not present (No Response)\n");
return (-1);
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
printf(" This option is not implemented for this board\n");
return (-1);
}
@@ -274,7 +274,7 @@ ipmi_kontron_set_serial_number(struct ipmi_intf *intf)
free(sn);
sn = NULL;
return (-1);
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
free(sn);
@@ -307,7 +307,7 @@ ipmi_kontron_set_serial_number(struct ipmi_intf *intf)
free(sn);
sn = NULL;
return (-1);
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
free(sn);
@@ -535,7 +535,7 @@ ipmi_kontron_set_mfg_date (struct ipmi_intf *intf)
if (rsp == NULL) {
printf("Device not present (No Response)\n");
return(-1);
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
printf("This option is not implemented for this board\n");
return(-1);
}
@@ -557,7 +557,7 @@ ipmi_kontron_set_mfg_date (struct ipmi_intf *intf)
if (rsp == NULL) {
printf(" Device not present (No Response)\n");
return(-1);
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
return(-1);
@@ -585,7 +585,7 @@ ipmi_kontron_set_mfg_date (struct ipmi_intf *intf)
if (rsp == NULL) {
printf(" Device not present (No Response)\n");
return (-1);
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
printf(" Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
return (-1);
@@ -693,7 +693,7 @@ ipmi_kontron_nextboot_set(struct ipmi_intf *intf, int argc, char **argv)
if (rsp == NULL) {
printf("Device not present (No Response)\n");
return(-1);
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
printf("Device not present (%s)\n",
val2str(rsp->ccode, completion_code_vals));
return (-1);
diff --git a/lib/ipmi_lanp.c b/lib/ipmi_lanp.c
index 0d6a0a6..f2c1031 100644
--- a/lib/ipmi_lanp.c
+++ b/lib/ipmi_lanp.c
@@ -312,11 +312,11 @@ __set_lan_param(struct ipmi_intf * intf, uint8_t chan,
req.msg.data_len = len+2;
rsp = intf->sendrecv(intf, &req);
- if (rsp == NULL) {
+ if (!rsp) {
lprintf(LOG_ERR, "Set LAN Parameter failed");
return -1;
}
- if ((rsp->ccode > 0) && (wait != 0)) {
+ if (rsp->ccode && wait) {
lprintf(LOG_DEBUG, "Warning: Set LAN Parameter failed: %s",
val2str(rsp->ccode, completion_code_vals));
if (rsp->ccode == 0xcc) {
@@ -328,9 +328,7 @@ __set_lan_param(struct ipmi_intf * intf, uint8_t chan,
break;
sleep(IPMI_LANP_TIMEOUT);
rsp = intf->sendrecv(intf, &req);
- if (rsp == NULL)
- continue;
- if (rsp->ccode > 0)
+ if (!rsp || rsp->ccode)
continue;
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 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);
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Get LAN Stats command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return (-1);
@@ -2150,7 +2148,7 @@ ipmi_lan_stats_clear(struct ipmi_intf * intf, uint8_t chan)
return (-1);
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_INFO, "Get LAN Stats command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return (-1);
diff --git a/lib/ipmi_mc.c b/lib/ipmi_mc.c
index 4f3c064..0edfc55 100644
--- a/lib/ipmi_mc.c
+++ b/lib/ipmi_mc.c
@@ -89,7 +89,7 @@ ipmi_mc_reset(struct ipmi_intf * intf, int cmd)
} else if (rsp == NULL) {
lprintf(LOG_ERR, "MC reset command failed.");
return (-1);
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "MC reset command failed: %s",
CC_STRING(rsp->ccode));
return (-1);
@@ -285,7 +285,7 @@ ipmi_mc_get_enables(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Get Global Enables command failed");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Get Global Enables command failed: %s",
CC_STRING(rsp->ccode));
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");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Get Global Enables command failed: %s",
CC_STRING(rsp->ccode));
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");
return -1;
}
- else if (rsp->ccode > 0) {
+ else if (rsp->ccode) {
lprintf(LOG_ERR, "Set Global Enables command failed: %s",
CC_STRING(rsp->ccode));
return -1;
@@ -427,7 +427,7 @@ ipmi_mc_get_deviceid(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Get Device ID command failed");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Get Device ID command failed: %s",
CC_STRING(rsp->ccode));
return -1;
@@ -509,7 +509,7 @@ _ipmi_mc_get_guid(struct ipmi_intf *intf, struct ipmi_guid_t *guid)
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
return (-1);
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
return rsp->ccode;
} else if (rsp->data_len != 16
|| 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)
return (-1);
- if (rsp->ccode == 0) {
+ if (!rsp->ccode) {
if (len > rsp->data_len)
len = rsp->data_len;
if (len && buffer)
diff --git a/lib/ipmi_pef.c b/lib/ipmi_pef.c
index bbf25f2..96bf1bd 100644
--- a/lib/ipmi_pef.c
+++ b/lib/ipmi_pef.c
@@ -259,7 +259,7 @@ _ipmi_get_pef_capabilities(struct ipmi_intf *intf,
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
return (-1);
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
return rsp->ccode;
} else if (rsp->data_len != 3) {
return (-2);
@@ -305,7 +305,7 @@ _ipmi_get_pef_filter_entry(struct ipmi_intf *intf, uint8_t filter_id,
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
return (-1);
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
return rsp->ccode;
} else if (rsp->data_len != 22 || (rsp->data_len - 1) != dest_size) {
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);
if (rsp == NULL) {
return (-1);
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
return rsp->ccode;
} else if (rsp->data_len != 3 || (rsp->data_len - 1) != dest_size) {
return (-2);
@@ -393,7 +393,7 @@ _ipmi_get_pef_policy_entry(struct ipmi_intf *intf, uint8_t policy_id,
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
return (-1);
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
return rsp->ccode;
} else if (rsp->data_len != 5 || (rsp->data_len - 1) != dest_size) {
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);
if (rsp == NULL) {
return (-1);
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
return rsp->ccode;
} else if (rsp->data_len != 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);
if (rsp == NULL) {
return (-1);
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
return rsp->ccode;
} else if (rsp->data_len != 2) {
return (-2);
@@ -510,7 +510,7 @@ _ipmi_get_pef_system_guid(struct ipmi_intf *intf,
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
return (-1);
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
return rsp->ccode;
} else if (rsp->data_len != 18
|| (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);
if (rsp == NULL) {
return (-1);
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
return rsp->ccode;
}
return 0;
@@ -595,7 +595,7 @@ _ipmi_set_pef_policy_entry(struct ipmi_intf *intf, uint8_t policy_id,
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
return (-1);
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
return rsp->ccode;
}
return 0;
diff --git a/lib/ipmi_picmg.c b/lib/ipmi_picmg.c
index 5684840..a5a84e3 100644
--- a/lib/ipmi_picmg.c
+++ b/lib/ipmi_picmg.c
@@ -1649,7 +1649,7 @@ ipmi_picmg_clk_get(struct ipmi_intf * intf, uint8_t clk_id, int8_t clk_res,
return -1;
}
- if (rsp->ccode == 0 ) {
+ if (!rsp->ccode) {
enabled = (rsp->data[1]&0x8)!=0;
direction = (rsp->data[1]&0x4)!=0;
@@ -2353,7 +2353,7 @@ picmg_discover(struct ipmi_intf *intf) {
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
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",
rsp->ccode);
} else if (rsp->data_len < 4) {
diff --git a/lib/ipmi_raw.c b/lib/ipmi_raw.c
index 92c0177..5d6cf21 100644
--- a/lib/ipmi_raw.c
+++ b/lib/ipmi_raw.c
@@ -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");
return NULL;
}
- else if (rsp->ccode > 0) {
+ else if (rsp->ccode) {
switch (rsp->ccode) {
case 0x81:
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);
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Unable to send RAW command "
"(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,
diff --git a/lib/ipmi_sdr.c b/lib/ipmi_sdr.c
index 70a9636..aa6c672 100644
--- a/lib/ipmi_sdr.c
+++ b/lib/ipmi_sdr.c
@@ -810,7 +810,7 @@ ipmi_sdr_get_header(struct ipmi_intf *intf, struct ipmi_sdr_iterator *itr)
"Unable to renew SDR reservation");
return NULL;
}
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Get SDR %04x command failed: %s",
itr->next, val2str(rsp->ccode,
completion_code_vals));
@@ -964,7 +964,7 @@ ipmi_sdr_print_sensor_event_status(struct ipmi_intf *intf,
sensor_num);
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_DEBUG,
"Error reading event status for sensor #%02x: %s",
sensor_num, val2str(rsp->ccode, completion_code_vals));
@@ -1178,7 +1178,7 @@ ipmi_sdr_print_sensor_event_enable(struct ipmi_intf *intf,
sensor_num);
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_DEBUG,
"Error reading event enable for sensor #%02x: %s",
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 */
if (rsp == NULL)
return -1;
- if (rsp->ccode > 0)
+ if (rsp->ccode)
return -1;
*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;
return NULL;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Get Device ID command failed: %#x %s",
rsp->ccode, val2str(rsp->ccode, completion_code_vals));
free(itr);
@@ -2880,7 +2880,7 @@ ipmi_sdr_start(struct ipmi_intf *intf, int use_builtin)
itr = NULL;
return NULL;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Error obtaining SDR info: %s",
val2str(rsp->ccode, completion_code_vals));
free(itr);
@@ -3054,7 +3054,7 @@ ipmi_sdr_get_record(struct ipmi_intf * intf, struct sdr_get_rs * header,
}
/* special completion codes handled above */
- if (rsp->ccode > 0 || rsp->data_len == 0) {
+ if (rsp->ccode || rsp->data_len == 0) {
free(data);
data = NULL;
return NULL;
@@ -4195,7 +4195,7 @@ ipmi_sdr_get_info(struct ipmi_intf *intf,
lprintf(LOG_ERR, "Get SDR Repository Info command failed");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Get SDR Repository Info command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
diff --git a/lib/ipmi_sdradd.c b/lib/ipmi_sdradd.c
index 52848a3..9f7c758 100644
--- a/lib/ipmi_sdradd.c
+++ b/lib/ipmi_sdradd.c
@@ -206,7 +206,7 @@ ipmi_sdr_repo_clear(struct ipmi_intf *intf)
lprintf(LOG_ERR, "Unable to clear SDRR");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Unable to clear SDRR: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
diff --git a/lib/ipmi_sel.c b/lib/ipmi_sel.c
index dfd1366..792b69c 100644
--- a/lib/ipmi_sel.c
+++ b/lib/ipmi_sel.c
@@ -318,7 +318,7 @@ ipmi_get_oem(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Get Device ID command failed");
return IPMI_OEM_UNKNOWN;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Get Device ID command failed: %#x %s",
rsp->ccode, val2str(rsp->ccode, completion_code_vals));
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");
return -1;
}
- else if (rsp->ccode > 0) {
+ else if (rsp->ccode) {
lprintf(LOG_ERR, "Add SEL Entry failed: %s",
val2str(rsp->ccode, completion_code_vals));
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");
return NULL;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
if (verbose)
lprintf(LOG_ERR, "OEM command returned error code: %s",
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;
}
return NULL;
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, " Error getting system info: %s",
val2str(rsp->ccode, completion_code_vals));
if (desc != NULL) {
@@ -792,7 +792,7 @@ char * get_dell_evt_desc(struct ipmi_intf * intf, struct sel_event_record * rec)
}
return NULL;
}
- else if (rsp->ccode > 0)
+ else if (rsp->ccode)
{
lprintf(LOG_ERR, " Error getting system info: %s",
val2str(rsp->ccode, completion_code_vals));
@@ -1548,7 +1548,7 @@ ipmi_sel_get_info(struct ipmi_intf * intf)
if (rsp == NULL) {
lprintf(LOG_ERR, "Get SEL Info command failed");
return -1;
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Get SEL Info command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -1631,7 +1631,7 @@ ipmi_sel_get_info(struct ipmi_intf * intf)
"Get SEL Allocation Info command failed");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR,
"Get SEL Allocation Info command failed: %s",
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);
return 0;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Get SEL Entry %x command failed: %s",
id, val2str(rsp->ccode, completion_code_vals));
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");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Get SEL Info command failed: %s",
val2str(rsp->ccode, completion_code_vals));
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");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Reserve SEL command failed: %s",
val2str(rsp->ccode, completion_code_vals));
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");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Get SEL Info command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -2702,7 +2702,7 @@ ipmi_sel_reserve(struct ipmi_intf * intf)
lprintf(LOG_WARN, "Unable to reserve SEL");
return 0;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
printf("Unable to reserve SEL: %s",
val2str(rsp->ccode, completion_code_vals));
return 0;
@@ -2734,7 +2734,7 @@ ipmi_sel_get_time(struct ipmi_intf * intf)
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",
rsp
? val2str(rsp->ccode, completion_code_vals)
@@ -2838,7 +2838,7 @@ ipmi_sel_set_time(struct ipmi_intf * intf, const char * time_string)
#endif
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",
rsp
? val2str(rsp->ccode, completion_code_vals)
@@ -2883,7 +2883,7 @@ ipmi_sel_clear(struct ipmi_intf * intf)
lprintf(LOG_ERR, "Unable to clear SEL");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Unable to clear SEL: %s",
val2str(rsp->ccode, completion_code_vals));
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);
rc = -1;
}
- else if (rsp->ccode > 0) {
+ else if (rsp->ccode) {
lprintf(LOG_ERR, "Unable to delete entry %d: %s", id,
val2str(rsp->ccode, completion_code_vals));
rc = -1;
diff --git a/lib/ipmi_sensor.c b/lib/ipmi_sensor.c
index a0b7eb8..559b19d 100644
--- a/lib/ipmi_sensor.c
+++ b/lib/ipmi_sensor.c
@@ -266,7 +266,7 @@ ipmi_sensor_print_fc_threshold(struct ipmi_intf *intf,
sensor->keys.sensor_num, sensor->keys.owner_id,
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;
if (csv_output) {
@@ -485,7 +485,7 @@ __ipmi_sensor_set_threshold(struct ipmi_intf *intf,
lprintf(LOG_ERR, "Error setting threshold");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Error setting threshold: %s",
val2str(rsp->ccode, completion_code_vals));
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.lun,
sdr->record.common->keys.channel);
- if ((rsp == NULL) || (rsp->ccode > 0)) {
+ if (!rsp || rsp->ccode) {
lprintf(LOG_ERR, "Sensor data record not found!");
return -1;
}
diff --git a/lib/ipmi_session.c b/lib/ipmi_session.c
index 141f0f4..5e6f247 100644
--- a/lib/ipmi_session.c
+++ b/lib/ipmi_session.c
@@ -293,7 +293,7 @@ ipmi_get_session_info(struct ipmi_intf * intf,
lprintf(LOG_ERR, "Get Session Info command failed");
retval = -1;
}
- else if (rsp->ccode > 0)
+ else if (rsp->ccode)
{
lprintf(LOG_ERR, "Get Session Info command failed: %s",
val2str(rsp->ccode, completion_code_vals));
@@ -328,7 +328,7 @@ ipmi_get_session_info(struct ipmi_intf * intf,
retval = -1;
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",
val2str(rsp->ccode, completion_code_vals));
diff --git a/lib/ipmi_sol.c b/lib/ipmi_sol.c
index d22c9e4..f71d85a 100644
--- a/lib/ipmi_sol.c
+++ b/lib/ipmi_sol.c
@@ -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",
enable ? "en" : "dis", userid, channel);
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",
enable ? "en" : "dis", userid, channel,
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)) &&
- rsp->ccode > 0) {
+ rsp->ccode) {
switch (rsp->ccode) {
case 0x80:
lprintf(LOG_ERR, "Error setting SOL parameter '%s': "
diff --git a/lib/ipmi_sunoem.c b/lib/ipmi_sunoem.c
index 00a865d..0e70e56 100644
--- a/lib/ipmi_sunoem.c
+++ b/lib/ipmi_sunoem.c
@@ -285,7 +285,7 @@ sunoem_led_get(struct ipmi_intf * intf, struct sdr_record_generic_locator * dev,
if (rsp == NULL) {
*loc_rsp = NULL;
return (SUNOEM_EC_BMC_NOT_RESPONDING);
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
*loc_rsp = rsp;
return (SUNOEM_EC_BMC_CCODE_NONZERO);
} else {
@@ -332,7 +332,7 @@ sunoem_led_set(struct ipmi_intf * intf, struct sdr_record_generic_locator * dev,
if (rsp == NULL) {
lprintf(LOG_ERR, "Sun OEM Set LED command failed.");
return NULL;
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Sun OEM Set LED command failed: %s",
val2str(rsp->ccode, completion_code_vals));
return NULL;
@@ -692,7 +692,7 @@ ipmi_sunoem_led_set(struct ipmi_intf * intf, int argc, char ** argv)
if (a->record.genloc->entity.logical)
continue;
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,
PRINT_NORMAL, ledmode);
else
@@ -724,7 +724,7 @@ ipmi_sunoem_led_set(struct ipmi_intf * intf, int argc, char ** argv)
* handle physical entity
*/
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);
else
return (-1);
@@ -815,7 +815,7 @@ ipmi_sunoem_sshkey_del(struct ipmi_intf * intf, uint8_t uid)
if (rsp == NULL) {
lprintf(LOG_ERR, "Unable to delete ssh key for UID %d", uid);
return (-1);
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Unable to delete ssh key for UID %d: %s", uid,
val2str(rsp->ccode, completion_code_vals));
return (-1);
@@ -937,7 +937,7 @@ ipmi_sunoem_sshkey_set(struct ipmi_intf * intf, uint8_t uid, char * ifile)
return (-1);
} /* if (rsp == NULL) */
- if (rsp->ccode != 0) {
+ if (rsp->ccode) {
printf("failed\n");
lprintf(LOG_ERR, "Unable to set ssh key for UID %d, %s.", uid,
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);
return (-1);
- } /* if (rsp->ccode != 0) */
+ }
}
printf("done\n");
@@ -1095,7 +1095,7 @@ ipmi_sunoem_cli(struct ipmi_intf * intf, int argc, char *argv[])
return (-1);
}
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,
sizeof(SUNOEM_CLI_INVALID_VER_ERR) - 1) == 0
|| 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);
}
}
- while (rsp->ccode == 0 && cli_rsp->command_response == 0) {
+ while (!rsp->ccode && cli_rsp->command_response == 0) {
int rc = 0;
int count = 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 */
count = 0; /* Don't re-send the client's data */
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;
}
} 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);
resp_time = ((end_time.tv_sec - start_time.tv_sec) * 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",
echo_req.seq_num);
rc = (-2);
@@ -1504,7 +1504,7 @@ ipmi_sunoem_getversion(struct ipmi_intf * intf,
lprintf(LOG_ERR, "Sun OEM Get SP Version Failed.");
return (-1);
}
- if (rsp->ccode != 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Sun OEM Get SP Version Failed: %d", rsp->ccode);
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.");
return (-1);
}
- if (rsp->ccode != 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Sun OEM nacname command failed: %d", rsp->ccode);
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.");
return (-1);
}
- if (rsp->ccode != 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Sun OEM getval1 command failed: %d", rsp->ccode);
return (-1);
}
@@ -1847,7 +1847,7 @@ ipmi_sunoem_getval(struct ipmi_intf * intf, int argc, char *argv[])
return (-1);
}
- if (rsp->ccode != 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Sun OEM getval2 command failed: %d", rsp->ccode);
return (-1);
}
@@ -1915,7 +1915,7 @@ send_luapi_prop_name(struct ipmi_intf * intf, int len, char *prop_name,
return (-1);
}
- if (rsp->ccode != 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Sun OEM setval prop name: request failed: %d",
rsp->ccode);
return (-1);
@@ -1988,7 +1988,7 @@ send_luapi_prop_value(struct ipmi_intf * intf, int len, char *prop_value,
return (-1);
}
- if (rsp->ccode != 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Sun OEM setval prop value: request failed: %d",
rsp->ccode);
return (-1);
@@ -2081,7 +2081,7 @@ ipmi_sunoem_setval(struct ipmi_intf * intf, int argc, char *argv[])
return (-1);
}
- if (rsp->ccode != 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Sun OEM setval command failed: %d", rsp->ccode);
return (-1);
}
@@ -2192,7 +2192,7 @@ ipmi_sunoem_getfile(struct ipmi_intf * intf, int argc, char *argv[])
fclose(fp);
return (-1);
}
- if (rsp->ccode != 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Sun OEM getfile command failed: %d", rsp->ccode);
fclose(fp);
return (-1);
@@ -2305,7 +2305,7 @@ ipmi_sunoem_getbehavior(struct ipmi_intf * intf, int argc, char *argv[])
return (-1);
}
- if (rsp->ccode != 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Sun OEM getbehavior command failed: %d", rsp->ccode);
return (-1);
}
diff --git a/lib/ipmi_tsol.c b/lib/ipmi_tsol.c
index 0d2235c..a5cb222 100644
--- a/lib/ipmi_tsol.c
+++ b/lib/ipmi_tsol.c
@@ -107,7 +107,7 @@ ipmi_tsol_command(struct ipmi_intf *intf, char *recvip, int port,
lprintf(LOG_ERR, "Unable to perform TSOL command");
return (-1);
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Unable to perform TSOL command: %s",
val2str(rsp->ccode, completion_code_vals));
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");
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Unable to send keystroke: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
diff --git a/lib/ipmi_user.c b/lib/ipmi_user.c
index eb0dff9..afa7044 100644
--- a/lib/ipmi_user.c
+++ b/lib/ipmi_user.c
@@ -80,7 +80,7 @@ _ipmi_get_user_access(struct ipmi_intf *intf,
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
return (-1);
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
return rsp->ccode;
} else if (rsp->data_len != 4) {
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);
if (rsp == NULL) {
return (-1);
- } else if (rsp->ccode > 0) {
+ } else if (rsp->ccode) {
return rsp->ccode;
} else if (rsp->data_len != 16) {
return (-2);
@@ -380,7 +380,7 @@ ipmi_user_set_username(
user_id, name);
return -1;
}
- if (rsp->ccode > 0) {
+ if (rsp->ccode) {
lprintf(LOG_ERR, "Set User Name command failed (user %d, name %s): %s",
user_id, name, val2str(rsp->ccode, completion_code_vals));
return -1;
diff --git a/lib/ipmi_vita.c b/lib/ipmi_vita.c
index 3900974..7154e75 100644
--- a/lib/ipmi_vita.c
+++ b/lib/ipmi_vita.c
@@ -198,7 +198,7 @@ vita_discover(struct ipmi_intf *intf)
} else if (rsp->ccode == 0xCC) {
lprintf(LOG_INFO, "Invalid data field received: %s",
val2str(rsp->ccode, completion_code_vals));
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_INFO, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals));
} else if (rsp->data_len < 5) {
@@ -242,7 +242,7 @@ ipmi_vita_ipmb_address(struct ipmi_intf *intf)
if (rsp == NULL) {
lprintf(LOG_ERR, "No valid response received");
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals));
} else if (rsp->data_len < 7) {
@@ -287,7 +287,7 @@ ipmi_vita_getaddr(struct ipmi_intf *intf, int argc, char **argv)
if (rsp == NULL) {
lprintf(LOG_ERR, "No valid response received");
return -1;
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -335,7 +335,7 @@ ipmi_vita_get_vso_capabilities(struct ipmi_intf *intf)
if (rsp == NULL) {
lprintf(LOG_ERR, "No valid response received.");
return -1;
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -405,7 +405,7 @@ ipmi_vita_set_fru_activation(struct ipmi_intf *intf,
if (rsp == NULL) {
lprintf(LOG_ERR, "No valid response received.");
return -1;
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -447,7 +447,7 @@ ipmi_vita_get_fru_state_policy_bits(struct ipmi_intf *intf, char **argv)
if (rsp == NULL) {
lprintf(LOG_ERR, "No valid response received.");
return -1;
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -502,7 +502,7 @@ ipmi_vita_set_fru_state_policy_bits(struct ipmi_intf *intf, char **argv)
if (rsp == NULL) {
lprintf(LOG_ERR, "No valid response received.");
return -1;
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -543,7 +543,7 @@ ipmi_vita_get_led_properties(struct ipmi_intf *intf, char **argv)
if (rsp == NULL) {
lprintf(LOG_ERR, "No valid response received.");
return -1;
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -588,7 +588,7 @@ ipmi_vita_get_led_color_capabilities(struct ipmi_intf *intf, char **argv)
if (rsp == NULL) {
lprintf(LOG_ERR, "No valid response received.");
return -1;
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -652,7 +652,7 @@ ipmi_vita_get_led_state(struct ipmi_intf *intf, char **argv)
if (rsp == NULL) {
lprintf(LOG_ERR, "No valid response received.");
return -1;
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -752,7 +752,7 @@ ipmi_vita_set_led_state(struct ipmi_intf *intf, char **argv)
if (rsp == NULL) {
lprintf(LOG_ERR, "No valid response received.");
return -1;
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;
@@ -799,7 +799,7 @@ ipmi_vita_fru_control(struct ipmi_intf *intf, char **argv)
if (rsp == NULL) {
lprintf(LOG_ERR, "No valid response received.");
return -1;
- } else if (rsp->ccode != 0) {
+ } else if (rsp->ccode) {
lprintf(LOG_ERR, "Invalid completion code received: %s",
val2str(rsp->ccode, completion_code_vals));
return -1;