/* Function for doing action upon flash operation failure event. 
Function for doing action upon flash operation failure event, which includes retrying the last operation or if retry count has been reached completing the operation with appropriate result code and transitioning to an error state. */
static void flash_operation_failure_run(void)
/* Function for doing action upon flash operation failure event. 
Function for doing action upon flash operation failure event, which includes retrying the last operation or if retry count has been reached completing the operation with appropriate result code and transitioning to an error state. */
static void flash_operation_failure_run(void)
{   
    if (++m_num_of_command_retries != SD_CMD_MAX_TRIES)
    {
        if (m_state != STATE_DATA_ERASE_WITH_SWAP)
        {
            sm_state_change(m_state);        
        }
        else
        {
            swap_sub_state_state_change(m_swap_sub_state);
        }
    }
    else
    {
        app_notify_error_state_transit(NRF_ERROR_TIMEOUT);        
    }   
}