On Mon, Jan 22, 2018 at 7:30 PM, Philippe Mathieu-Daudé <f4...@amsat.org> wrote: > replace switch(single case) -> if() > > Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org>
Reviewed-by: Alistair Francis <alistair.fran...@xilinx.com> Alistair > --- > hw/sd/sd.c | 26 +++++++++++--------------- > 1 file changed, 11 insertions(+), 15 deletions(-) > > diff --git a/hw/sd/sd.c b/hw/sd/sd.c > index b5c947df62..707c294169 100644 > --- a/hw/sd/sd.c > +++ b/hw/sd/sd.c > @@ -1015,23 +1015,19 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, > SDRequest req) > > 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) { > -- > 2.15.1 > >