qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 07/14] sdcard: Invert the sd_req_crc_is_valid


From: Alistair Francis
Subject: Re: [Qemu-devel] [PATCH v2 07/14] sdcard: Invert the sd_req_crc_is_valid() logic
Date: Wed, 9 May 2018 11:02:01 -0700

On Tue, May 8, 2018 at 8:46 PM, Philippe Mathieu-Daudé <address@hidden> wrote:
> Let's return TRUE when the CRC is valid.
>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>

Reviewed-by: Alistair Francis <address@hidden>

Alistair

> ---
>  hw/sd/sd.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/hw/sd/sd.c b/hw/sd/sd.c
> index d8dad94fc4..6fc8daa5b8 100644
> --- a/hw/sd/sd.c
> +++ b/hw/sd/sd.c
> @@ -467,13 +467,13 @@ static void sd_set_sdstatus(SDState *sd)
>      memset(sd->sd_status, 0, 64);
>  }
>
> -static int sd_req_crc_validate(SDRequest *req)
> +static bool sd_req_crc_is_valid(SDRequest *req)
>  {
>      uint8_t buffer[5];
>      buffer[0] = 0x40 | req->cmd;
>      stl_be_p(&buffer[1], req->arg);
> -    return 0;
> -    return sd_frame48_calc_checksum(buffer) != req->crc; /* TODO */
> +    return true;
> +    return sd_frame48_calc_checksum(buffer) == req->crc; /* TODO */
>  }
>
>  static void sd_response_r1_make(SDState *sd, uint8_t *response)
> @@ -1631,7 +1631,7 @@ int sd_do_command(SDState *sd, SDRequest *req,
>          return 0;
>      }
>
> -    if (sd_req_crc_validate(req)) {
> +    if (!sd_req_crc_is_valid(req)) {
>          sd->card_status |= COM_CRC_ERROR;
>          rtype = sd_illegal;
>          goto send_response;
> --
> 2.17.0
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]