Skip to content

Commit

Permalink
hw/sd/sdcard: Constify sd_crc*()'s message argument
Browse files Browse the repository at this point in the history
CRC functions don't modify the buffer argument,
make it const.

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20200630133912.9428-14-f4bug@amsat.org>
  • Loading branch information
philmd committed Oct 25, 2020
1 parent ef6dd5f commit aecaa05
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions hw/sd/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,11 @@ static const int sd_cmd_class[SDMMC_CMD_MAX] = {
7, 7, 10, 7, 9, 9, 9, 8, 8, 10, 8, 8, 8, 8, 8, 8,
};

static uint8_t sd_crc7(void *message, size_t width)
static uint8_t sd_crc7(const void *message, size_t width)
{
int i, bit;
uint8_t shift_reg = 0x00;
uint8_t *msg = (uint8_t *) message;
const uint8_t *msg = (const uint8_t *)message;

for (i = 0; i < width; i ++, msg ++)
for (bit = 7; bit >= 0; bit --) {
Expand All @@ -270,11 +270,11 @@ static uint8_t sd_crc7(void *message, size_t width)
return shift_reg;
}

static uint16_t sd_crc16(void *message, size_t width)
static uint16_t sd_crc16(const void *message, size_t width)
{
int i, bit;
uint16_t shift_reg = 0x0000;
uint16_t *msg = (uint16_t *) message;
const uint16_t *msg = (const uint16_t *)message;
width <<= 1;

for (i = 0; i < width; i ++, msg ++)
Expand Down

0 comments on commit aecaa05

Please sign in to comment.