Skip to content

Commit

Permalink
coverity: resource: ubridge: fix potential logical dead code in _cmd_…
Browse files Browse the repository at this point in the history
…exec_scan
  • Loading branch information
prajnoha committed Nov 14, 2023
1 parent c5fe90b commit 96dd0ab
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/resource/ubridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -4647,16 +4647,17 @@ static int _cmd_exec_scan(sid_resource_t *cmd_res)
ucmd_ctx->scan.phase = phase;

if (_cmd_scan_phase_regs[phase].exec(cmd_res) < 0) {
log_error(ID(cmd_res),
"%s phase failed. Switching to %s phase.",
_cmd_scan_phase_regs[phase].name,
_cmd_scan_phase_regs[CMD_SCAN_PHASE_ERROR].name);

ucmd_ctx->scan.phase = phase = CMD_SCAN_PHASE_ERROR;

/* if init or cleanup phase fails, there's nothing else we can do */
if (phase == CMD_SCAN_PHASE_A_INIT || phase == CMD_SCAN_PHASE_A_CLEANUP)
if (phase == CMD_SCAN_PHASE_A_INIT || phase == CMD_SCAN_PHASE_A_CLEANUP) {
log_error(ID(cmd_res), "%s phase failed.", _cmd_scan_phase_regs[phase].name);
return -1;
} else
log_error(ID(cmd_res),
"%s phase failed. Switching to %s phase.",
_cmd_scan_phase_regs[phase].name,
_cmd_scan_phase_regs[CMD_SCAN_PHASE_ERROR].name);

ucmd_ctx->scan.phase = phase = CMD_SCAN_PHASE_ERROR;

/* otherwise, call out modules to handle the error case */
if (_cmd_scan_phase_regs[CMD_SCAN_PHASE_ERROR].exec(cmd_res) < 0)
Expand Down

0 comments on commit 96dd0ab

Please sign in to comment.