summaryrefslogtreecommitdiff
path: root/lib/ipmi_hpmfwupg.c
diff options
context:
space:
mode:
authorAlexander Amelkin <alexander@amelkin.msk.ru>2018-08-15 13:16:37 +0300
committerAlexander Amelkin <alexander@amelkin.msk.ru>2018-08-21 11:55:03 +0300
commit9ecfb762bdc0c87a9e13683e165871475db6a96b (patch)
tree8e2374525030b3c260b825c715452bd4820ef6ed /lib/ipmi_hpmfwupg.c
parentbb1a4cc80568a5cd3384c2c2303bf3d0f3b9a5dd (diff)
downloadipmitool-9ecfb762bdc0c87a9e13683e165871475db6a96b.tar.gz
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>
Diffstat (limited to 'lib/ipmi_hpmfwupg.c')
-rw-r--r--lib/ipmi_hpmfwupg.c14
1 files changed, 7 insertions, 7 deletions
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,