Skip to content

Commit

Permalink
hw/sd.c: Handle CRC and locked-card errors in normal code path
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
pm215 authored and balrog-kun committed Dec 21, 2011
1 parent 53bb8cc commit b1f517e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions hw/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,8 @@ int sd_do_command(SDState *sd, SDRequest *req,

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;
Expand All @@ -1306,7 +1307,8 @@ int sd_do_command(SDState *sd, SDRequest *req,
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;
}
}

Expand All @@ -1322,6 +1324,7 @@ int sd_do_command(SDState *sd, SDRequest *req,

sd->current_cmd = req->cmd;

send_response:
switch (rtype) {
case sd_r1:
case sd_r1b:
Expand Down

0 comments on commit b1f517e

Please sign in to comment.