ID: 50 - ipmi_hpmfwupg needs a clean up

HpmfwupgUpgradeStage() - kill one level of indentation by changing one if().
This commit is contained in:
Zdenek Styblik 2013-10-10 12:26:46 +00:00
parent 7a0b451fd7
commit f19ed0a90b

View File

@ -1137,58 +1137,59 @@ HpmfwupgUpgradeStage(struct ipmi_intf *intf,
pActionRecord = (struct HpmfwupgActionRecord*)pImagePtr; pActionRecord = (struct HpmfwupgActionRecord*)pImagePtr;
/* Validate action record checksum */ /* Validate action record checksum */
rc = HpmfwupgValidateActionRecordChecksum(pActionRecord); rc = HpmfwupgValidateActionRecordChecksum(pActionRecord);
if (rc == HPMFWUPG_SUCCESS) { if (rc != HPMFWUPG_SUCCESS) {
switch(pActionRecord->actionType) { continue;
case HPMFWUPG_ACTION_BACKUP_COMPONENTS: }
{ switch(pActionRecord->actionType) {
if (!(option & COMPARE_MODE)) { case HPMFWUPG_ACTION_BACKUP_COMPONENTS:
/* Send Upgrade Action command */ {
struct HpmfwupgInitiateUpgradeActionCtx initUpgActionCmd; if (!(option & COMPARE_MODE)) {
/* Affect only selected components */ /* Send Upgrade Action command */
initUpgActionCmd.req.componentsMask.ComponentBits.byte = struct HpmfwupgInitiateUpgradeActionCtx initUpgActionCmd;
pFwupgCtx->compUpdateMask.ComponentBits.byte & /* Affect only selected components */
pActionRecord->components.ComponentBits.byte; initUpgActionCmd.req.componentsMask.ComponentBits.byte =
/* Action is prepare components */ pFwupgCtx->compUpdateMask.ComponentBits.byte &
if (initUpgActionCmd.req.componentsMask.ComponentBits.byte) { pActionRecord->components.ComponentBits.byte;
initUpgActionCmd.req.upgradeAction = HPMFWUPG_UPGRADE_ACTION_BACKUP; /* Action is prepare components */
rc = HpmfwupgInitiateUpgradeAction(intf, &initUpgActionCmd, pFwupgCtx); if (initUpgActionCmd.req.componentsMask.ComponentBits.byte) {
} initUpgActionCmd.req.upgradeAction = HPMFWUPG_UPGRADE_ACTION_BACKUP;
rc = HpmfwupgInitiateUpgradeAction(intf, &initUpgActionCmd, pFwupgCtx);
} }
pImagePtr+= sizeof(struct HpmfwupgActionRecord);
} }
break; pImagePtr+= sizeof(struct HpmfwupgActionRecord);
case HPMFWUPG_ACTION_PREPARE_COMPONENTS:
{
if (!(option & COMPARE_MODE)) {
/* Send prepare components command */
struct HpmfwupgInitiateUpgradeActionCtx initUpgActionCmd;
/* Affect only selected components */
initUpgActionCmd.req.componentsMask.ComponentBits.byte =
pFwupgCtx->compUpdateMask.ComponentBits.byte &
pActionRecord->components.ComponentBits.byte;
if (initUpgActionCmd.req.componentsMask.ComponentBits.byte) {
/* Action is prepare components */
initUpgActionCmd.req.upgradeAction = HPMFWUPG_UPGRADE_ACTION_PREPARE;
rc = HpmfwupgInitiateUpgradeAction(intf, &initUpgActionCmd, pFwupgCtx);
}
}
pImagePtr+= sizeof(struct HpmfwupgActionRecord);
}
break;
case HPMFWUPG_ACTION_UPLOAD_FIRMWARE:
/* Upload all firmware blocks */
rc = HpmFwupgActionUploadFirmware(pActionRecord->components,
pFwupgCtx,
&pImagePtr,
intf,
option,
&flagColdReset);
break;
default:
lprintf(LOG_NOTICE, " Invalid Action type. Cannot continue");
rc = HPMFWUPG_ERROR;
break;
} }
break;
case HPMFWUPG_ACTION_PREPARE_COMPONENTS:
{
if (!(option & COMPARE_MODE)) {
/* Send prepare components command */
struct HpmfwupgInitiateUpgradeActionCtx initUpgActionCmd;
/* Affect only selected components */
initUpgActionCmd.req.componentsMask.ComponentBits.byte =
pFwupgCtx->compUpdateMask.ComponentBits.byte &
pActionRecord->components.ComponentBits.byte;
if (initUpgActionCmd.req.componentsMask.ComponentBits.byte) {
/* Action is prepare components */
initUpgActionCmd.req.upgradeAction = HPMFWUPG_UPGRADE_ACTION_PREPARE;
rc = HpmfwupgInitiateUpgradeAction(intf, &initUpgActionCmd, pFwupgCtx);
}
}
pImagePtr+= sizeof(struct HpmfwupgActionRecord);
}
break;
case HPMFWUPG_ACTION_UPLOAD_FIRMWARE:
/* Upload all firmware blocks */
rc = HpmFwupgActionUploadFirmware(pActionRecord->components,
pFwupgCtx,
&pImagePtr,
intf,
option,
&flagColdReset);
break;
default:
lprintf(LOG_NOTICE, " Invalid Action type. Cannot continue");
rc = HPMFWUPG_ERROR;
break;
} }
} }
HpmDisplayLine("-", 79); HpmDisplayLine("-", 79);