summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2018-02-22 15:12:54 +0000
committerPeter Maydell <peter.maydell@linaro.org>2018-02-22 15:12:54 +0000
commitad0ade55479490fa57ffa31d50fb355e0084c61b (patch)
tree495a68e965b9513b9b89e89d6088ff9ed0f70eeb
parent3116280040a7ca898b925651001962167433b084 (diff)
downloadfocaccia-qemu-ad0ade55479490fa57ffa31d50fb355e0084c61b.tar.gz
focaccia-qemu-ad0ade55479490fa57ffa31d50fb355e0084c61b.zip
sdcard: simplify SEND_IF_COND (CMD8)
replace switch(single case) -> if()

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Message-id: 20180215221325.7611-16-f4bug@amsat.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/sd/sd.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index c8351d4f0b..25fce7d6b6 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -1008,23 +1008,19 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,
 
     case 8:	/* CMD8:   SEND_IF_COND */
         /* Physical Layer Specification Version 2.00 command */
-        switch (sd->state) {
-        case sd_idle_state:
-            sd->vhs = 0;
-
-            /* No response if not exactly one VHS bit is set.  */
-            if (!(req.arg >> 8) || (req.arg >> (ctz32(req.arg & ~0xff) + 1))) {
-                return sd->spi ? sd_r7 : sd_r0;
-            }
-
-            /* Accept.  */
-            sd->vhs = req.arg;
-            return sd_r7;
-
-        default:
+        if (sd->state != sd_idle_state) {
             break;
         }
-        break;
+        sd->vhs = 0;
+
+        /* No response if not exactly one VHS bit is set.  */
+        if (!(req.arg >> 8) || (req.arg >> (ctz32(req.arg & ~0xff) + 1))) {
+            return sd->spi ? sd_r7 : sd_r0;
+        }
+
+        /* Accept.  */
+        sd->vhs = req.arg;
+        return sd_r7;
 
     case 9:	/* CMD9:   SEND_CSD */
         switch (sd->state) {