Skip to content

Superfluous assignments at the top of functions #84

@thnkslprpt

Description

@thnkslprpt

Checklist

  • I reviewed the Contributing Guide.
  • I performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets.

Describe the bug
FM has a many extraneous assignments at the top of functions that are immediately (or definitely before first use) reassigned a value - many to CFE_SUCCESS as in nasa/HS#10, but also other to 0, OS_SUCCESS etc.

Code snips

FM/fsw/src/fm_child.c

Lines 61 to 65 in 5c9d4e8

int32 Result = CFE_SUCCESS;
uint32 TaskEID = 0;
/* Create counting semaphore (given by parent to wake-up child) */
Result = OS_CountSemCreate(&FM_GlobalData.ChildSemaphore, FM_CHILD_SEM_NAME, 0, 0);

FM/fsw/src/fm_child.c

Lines 1270 to 1273 in 5c9d4e8

int32 OS_Status = OS_SUCCESS;
const char *CmdText = "Set Permissions";
OS_Status = OS_chmod(CmdArgs->Source1, CmdArgs->Mode);

FM/fsw/src/fm_cmd_utils.c

Lines 535 to 537 in 5c9d4e8

uint32 StringLength = 0;
StringLength = strlen(Directory);

FM/fsw/src/fm_cmds.c

Lines 75 to 78 in 5c9d4e8

bool CommandResult = false;
/* Verify message length */
CommandResult = FM_IsValidCmdPktLength(&BufPtr->Msg, sizeof(FM_ResetCmd_t), FM_RESET_PKT_ERR_EID, CmdText);

Expected behavior
Remove/combine assignments - unnecessary code.

Reporter Info
Avi Weiss @thnkslprpt

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions