Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers/sdcard_spi: fix uint64_t cast location #9746

Merged
merged 1 commit into from
Aug 9, 2018

Conversation

cladmi
Copy link
Contributor

@cladmi cladmi commented Aug 9, 2018

Contribution description

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);

Issues/PRs references

RIOT-OS/Release-Specs#69 (comment)

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);
@cladmi cladmi added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Area: drivers Area: Device drivers labels Aug 9, 2018
@cladmi cladmi added this to the Release 2018.07 milestone Aug 9, 2018
@cladmi
Copy link
Contributor Author

cladmi commented Aug 9, 2018

@maribu could you check if it compiles without error now ?

@maribu
Copy link
Member

maribu commented Aug 9, 2018

It compiles now :-)

Building application "tests_driver_sdcard_spi" for "arduino-mega2560" with MCU "atmega2560".

"make" -C /home/maribu/Repos/software/RIOT/boards/arduino-mega2560
"make" -C /home/maribu/Repos/software/RIOT/boards/common/arduino-atmega
"make" -C /home/maribu/Repos/software/RIOT/boards/common/atmega
"make" -C /home/maribu/Repos/software/RIOT/core
"make" -C /home/maribu/Repos/software/RIOT/cpu/atmega2560
"make" -C /home/maribu/Repos/software/RIOT/cpu/atmega_common
"make" -C /home/maribu/Repos/software/RIOT/cpu/atmega_common/periph
"make" -C /home/maribu/Repos/software/RIOT/drivers
"make" -C /home/maribu/Repos/software/RIOT/drivers/periph_common
"make" -C /home/maribu/Repos/software/RIOT/drivers/sdcard_spi
"make" -C /home/maribu/Repos/software/RIOT/sys
"make" -C /home/maribu/Repos/software/RIOT/sys/auto_init
"make" -C /home/maribu/Repos/software/RIOT/sys/auto_init/storage
"make" -C /home/maribu/Repos/software/RIOT/sys/checksum
"make" -C /home/maribu/Repos/software/RIOT/sys/div
"make" -C /home/maribu/Repos/software/RIOT/sys/fmt
"make" -C /home/maribu/Repos/software/RIOT/sys/isrpipe
"make" -C /home/maribu/Repos/software/RIOT/sys/shell
"make" -C /home/maribu/Repos/software/RIOT/sys/tsrb
"make" -C /home/maribu/Repos/software/RIOT/sys/uart_stdio
"make" -C /home/maribu/Repos/software/RIOT/sys/xtimer
   text	   data	    bss	    dec	    hex	filename
  24200	   3072	   2860	  30132	   75b4	/home/maribu/Repos/software/RIOT/tests/driver_sdcard_spi/bin/arduino-mega2560/tests_driver_sdcard_spi.elf

@MichelRottleuthner MichelRottleuthner added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Aug 9, 2018
Copy link
Contributor

@MichelRottleuthner MichelRottleuthner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

@cladmi
Copy link
Contributor Author

cladmi commented Aug 9, 2018

Backport provided in #9747

@cladmi
Copy link
Contributor Author

cladmi commented Aug 9, 2018

Thanks

@cladmi cladmi deleted the pr/driver/sdcard_spi branch August 16, 2018 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: drivers Area: Device drivers CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants