1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/sdcard_spi: fix uint64_t cast location

When compiling `tests/drivers_sdcard_spi` with `avr-gcc: avr-gcc (GCC) 6.4.0`
it detected this error

    RIOT/drivers/sdcard_spi/sdcard_spi.c:1012:72:
    error: result of '512 << 10' requires 21 bits to represent, but 'int' only has 16 bits [-Werror=shift-overflow=]
    return (card->csd.v2.C_SIZE + 1) * (uint64_t)(SD_HC_BLOCK_SIZE << 10);
This commit is contained in:
Gaëtan Harter 2018-08-09 09:08:38 +02:00
parent 0e48bd0d93
commit 939ca4e1bf
No known key found for this signature in database
GPG Key ID: 76DF6BCF1B1F883B

View File

@ -1009,7 +1009,7 @@ uint64_t sdcard_spi_get_capacity(sdcard_spi_t *card)
return blocknr * block_len;
}
else if (card->csd_structure == SD_CSD_V2) {
return (card->csd.v2.C_SIZE + 1) * (uint64_t)(SD_HC_BLOCK_SIZE << 10);
return (card->csd.v2.C_SIZE + 1) * (((uint64_t)SD_HC_BLOCK_SIZE) << 10);
}
return 0;
}