Handle returning CRC and locked-card errors in the same code path
we use for other responses. This makes no difference in behaviour
but means that these error responses will be printed by the debug
logging code.
Signed-off-by: Peter Maydell <[email protected]>
Signed-off-by: Andrzej Zaborowski <[email protected]>
if (sd_req_crc_validate(req)) {
sd->card_status |= COM_CRC_ERROR;
- return 0;
+ rtype = sd_illegal;
+ goto send_response;
}
sd->card_status &= ~CARD_STATUS_B;
if (!cmd_valid_while_locked(sd, req)) {
sd->card_status |= ILLEGAL_COMMAND;
fprintf(stderr, "SD: Card is locked\n");
- return 0;
+ rtype = sd_illegal;
+ goto send_response;
}
}
sd->current_cmd = req->cmd;
+send_response:
switch (rtype) {
case sd_r1:
case sd_r1b: