From patchwork Sun Dec 18 20:37:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 5841 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 04AE623E2D for ; Sun, 18 Dec 2011 20:38:08 +0000 (UTC) Received: from mail-ey0-f180.google.com (mail-ey0-f180.google.com [209.85.215.180]) by fiordland.canonical.com (Postfix) with ESMTP id F0715A18284 for ; Sun, 18 Dec 2011 20:38:07 +0000 (UTC) Received: by mail-ey0-f180.google.com with SMTP id c11so1269913eaa.11 for ; Sun, 18 Dec 2011 12:38:07 -0800 (PST) Received: by 10.205.138.136 with SMTP id is8mr750493bkc.35.1324240687761; Sun, 18 Dec 2011 12:38:07 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.204.40.4 with SMTP id i4cs108681bke; Sun, 18 Dec 2011 12:38:07 -0800 (PST) Received: by 10.68.75.136 with SMTP id c8mr33646817pbw.113.1324240685416; Sun, 18 Dec 2011 12:38:05 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id o4si22519182pbn.170.2011.12.18.12.38.03 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 18 Dec 2011 12:38:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1RcNUe-00070a-QL; Sun, 18 Dec 2011 20:38:00 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org Subject: [PATCH 06/10] hw/sd.c: Handle CRC and locked-card errors in normal code path Date: Sun, 18 Dec 2011 20:37:56 +0000 Message-Id: <1324240680-26905-7-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1324240680-26905-1-git-send-email-peter.maydell@linaro.org> References: <1324240680-26905-1-git-send-email-peter.maydell@linaro.org> 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 --- hw/sd.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/sd.c b/hw/sd.c index 57925af..9116f67 100644 --- a/hw/sd.c +++ b/hw/sd.c @@ -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; @@ -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; } } @@ -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: