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: 132117 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 054F3B6FFB for ; Mon, 19 Dec 2011 08:01:54 +1100 (EST) Received: from localhost ([::1]:54203 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RcNVm-00084X-3H for incoming@patchwork.ozlabs.org; Sun, 18 Dec 2011 15:39:10 -0500 Received: from eggs.gnu.org ([140.186.70.92]:43044) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RcNUu-0005US-Vx for qemu-devel@nongnu.org; Sun, 18 Dec 2011 15:38:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RcNUt-00070N-VJ for qemu-devel@nongnu.org; Sun, 18 Dec 2011 15:38:16 -0500 Received: from mnementh.archaic.org.uk ([81.2.115.146]:38904) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RcNUt-0006yK-OX for qemu-devel@nongnu.org; Sun, 18 Dec 2011 15:38:15 -0500 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 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> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 81.2.115.146 Cc: patches@linaro.org Subject: [Qemu-devel] [PATCH 06/10] hw/sd.c: Handle CRC and locked-card errors in normal code path X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.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: