Skip to content

[Store] Remove unreachable INVALID_BATCH_ID check after freeBatchID#7

Open
stmatengss wants to merge 1 commit intohemist/cxl-level-storefrom
fix/dead-code-mp-submit-transfer
Open

[Store] Remove unreachable INVALID_BATCH_ID check after freeBatchID#7
stmatengss wants to merge 1 commit intohemist/cxl-level-storefrom
fix/dead-code-mp-submit-transfer

Conversation

@stmatengss
Copy link
Copy Markdown

Problem

In submitTransfer and mp_submitTransfer, after submission failure:

engine_.freeBatchID(batch_id);
return std::nullopt;
}

if (batch_id == INVALID_BATCH_ID) {  // ← unreachable dead code
    ...
}

batch_id is validated at function entry and cannot become INVALID_BATCH_ID between that guard and this check. The duplicate guard after the error-return path is never reached.

Fix

Remove both unreachable INVALID_BATCH_ID guards (one in submitTransfer, one in mp_submitTransfer).

Impact

  • No behavior change (guards were never triggered)
  • Eliminates misleading dead code

In submitTransfer and mp_submitTransfer, batch_id is validated once at
function entry. On submission failure the batch is freed and the function
returns immediately. A second INVALID_BATCH_ID guard placed after that
error path is unreachable dead code and should be removed.
@stmatengss stmatengss requested review from XucSh and YiXR as code owners April 22, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant