ID: 50 - ipmi_hpmfwupg needs a clean up

HpmfwupgActivateFirmware(), HpmfwupgGetUpgradeStatus() - kill one level of
indentation.
This commit is contained in:
Zdenek Styblik 2013-10-10 11:49:53 +00:00
parent 6de0796079
commit 80c03570ac

View File

@ -1944,23 +1944,22 @@ HpmfwupgFinishFirmwareUpload(struct ipmi_intf *intf,
req.msg.data = (unsigned char*)&pCtx->req; req.msg.data = (unsigned char*)&pCtx->req;
req.msg.data_len = sizeof(struct HpmfwupgFinishFirmwareUploadReq); req.msg.data_len = sizeof(struct HpmfwupgFinishFirmwareUploadReq);
rsp = HpmfwupgSendCmd(intf, req, pFwupgCtx); rsp = HpmfwupgSendCmd(intf, req, pFwupgCtx);
if (rsp) { if (rsp == NULL) {
/* Long duration command handling */ lprintf(LOG_ERR, "Error fininshing firmware upload.");
if (rsp->ccode == HPMFWUPG_COMMAND_IN_PROGRESS) { return HPMFWUPG_ERROR;
rc = HpmfwupgWaitLongDurationCmd(intf, pFwupgCtx); }
} else if ((option & COMPARE_MODE) && rsp->ccode == 0x83) { /* Long duration command handling */
printf("| |Component's active copy doesn't match the upgrade image |\n"); if (rsp->ccode == HPMFWUPG_COMMAND_IN_PROGRESS) {
} else if ((option & COMPARE_MODE) && rsp->ccode == IPMI_CC_OK) { rc = HpmfwupgWaitLongDurationCmd(intf, pFwupgCtx);
printf("| |Comparison passed |\n"); } else if ((option & COMPARE_MODE) && rsp->ccode == 0x83) {
} else if ( rsp->ccode != IPMI_CC_OK ) { printf("| |Component's active copy doesn't match the upgrade image |\n");
lprintf(LOG_NOTICE,"Error finishing firmware upload"); } else if ((option & COMPARE_MODE) && rsp->ccode == IPMI_CC_OK) {
lprintf(LOG_NOTICE,"compcode=0x%x: %s", printf("| |Comparison passed |\n");
rsp->ccode, } else if ( rsp->ccode != IPMI_CC_OK ) {
val2str(rsp->ccode, completion_code_vals)); lprintf(LOG_ERR, "Error finishing firmware upload");
rc = HPMFWUPG_ERROR; lprintf(LOG_ERR, "compcode=0x%x: %s",
} rsp->ccode,
} else { val2str(rsp->ccode, completion_code_vals));
lprintf(LOG_NOTICE,"Error fininshing firmware upload\n");
rc = HPMFWUPG_ERROR; rc = HPMFWUPG_ERROR;
} }
return rc; return rc;
@ -1982,26 +1981,25 @@ HpmfwupgActivateFirmware(struct ipmi_intf *intf,
req.msg.data_len = sizeof(struct HpmfwupgActivateFirmwareReq) req.msg.data_len = sizeof(struct HpmfwupgActivateFirmwareReq)
- (!pCtx->req.rollback_override ? 1 : 0); - (!pCtx->req.rollback_override ? 1 : 0);
rsp = HpmfwupgSendCmd(intf, req, pFwupgCtx); rsp = HpmfwupgSendCmd(intf, req, pFwupgCtx);
if (rsp) { if (rsp == NULL) {
/* Long duration command handling */ lprintf(LOG_ERR, "Error activating firmware.");
if (rsp->ccode == HPMFWUPG_COMMAND_IN_PROGRESS) { return HPMFWUPG_ERROR;
printf("Waiting firmware activation..."); }
fflush(stdout); /* Long duration command handling */
rc = HpmfwupgWaitLongDurationCmd(intf, pFwupgCtx); if (rsp->ccode == HPMFWUPG_COMMAND_IN_PROGRESS) {
if (rc == HPMFWUPG_SUCCESS) { printf("Waiting firmware activation...");
lprintf(LOG_NOTICE,"OK"); fflush(stdout);
} else { rc = HpmfwupgWaitLongDurationCmd(intf, pFwupgCtx);
lprintf(LOG_NOTICE,"Failed"); if (rc == HPMFWUPG_SUCCESS) {
} lprintf(LOG_NOTICE, "OK");
} else if (rsp->ccode != IPMI_CC_OK) { } else {
lprintf(LOG_NOTICE, "Error activating firmware"); lprintf(LOG_NOTICE, "Failed");
lprintf(LOG_NOTICE, "compcode=0x%x: %s",
rsp->ccode,
val2str(rsp->ccode, completion_code_vals));
rc = HPMFWUPG_ERROR;
} }
} else { } else if (rsp->ccode != IPMI_CC_OK) {
lprintf(LOG_NOTICE, "Error activating firmware\n"); lprintf(LOG_ERR, "Error activating firmware");
lprintf(LOG_ERR, "compcode=0x%x: %s",
rsp->ccode,
val2str(rsp->ccode, completion_code_vals));
rc = HPMFWUPG_ERROR; rc = HPMFWUPG_ERROR;
} }
return rc; return rc;