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

BlockDevices: minor fixes to cleanup compile warnings #444

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

pennam
Copy link
Contributor

@pennam pennam commented Feb 14, 2025

TestCodeFlash 👍
TestQSPI 👍
QSPIFormat 👍
QSPIReadPartitions 👍
FatFSOnQSPIFlash 👍
LittleFSOn QSPIFlash 👍
TestSDCard 👎 (also in released cores)

@pennam pennam requested a review from maidnl February 14, 2025 11:22
Copy link
Contributor

@maidnl maidnl left a comment

Choose a reason for hiding this comment

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

Just have a look on 2 small changes to avoid double cast

for(int i = 0; i < num_of_blocks && rv == FSP_SUCCESS; i++) {
rv = R_SDHI_Read (&ctrl, (uint8_t *)(buffer + (i * read_block_size)), start_add_of_block + i, 1);
for(uint32_t i = 0; i < num_of_blocks && rv == FSP_SUCCESS; i++) {
rv = R_SDHI_Read (&ctrl, (uint8_t *)((uint8_t *)buffer + (i * read_block_size)), start_add_of_block + i, 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

It is just a matter of personal taste but I would prefer this way without the double cast (to me is clearer)

Suggested change
rv = R_SDHI_Read (&ctrl, (uint8_t *)((uint8_t *)buffer + (i * read_block_size)), start_add_of_block + i, 1);
uint8_t *buf = (uint8_t *)buffer;
rv = R_SDHI_Read (&ctrl, buf + (i * read_block_size), start_add_of_block + i, 1);

for(int i = 0; i < num_of_blocks && rv == FSP_SUCCESS; i++) {
rv = R_SDHI_Write (&ctrl, (uint8_t *)(buffer + (i * write_block_size)), start_block_number + i, 1);
for(uint32_t i = 0; i < num_of_blocks && rv == FSP_SUCCESS; i++) {
rv = R_SDHI_Write (&ctrl, (uint8_t *)((uint8_t *)buffer + (i * write_block_size)), start_block_number + i, 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

It is just a matter of personal taste but I would prefer this way without the double cast (to me is clearer)

Suggested change
rv = R_SDHI_Write (&ctrl, (uint8_t *)((uint8_t *)buffer + (i * write_block_size)), start_block_number + i, 1);
uint8_t *buf = (uint8_t *)buffer;
rv = R_SDHI_Write (&ctrl, buf + (i * write_block_size), start_block_number + i, 1);

@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels Feb 14, 2025
@pennam pennam changed the title BlockDevices: minor fixes to clenup compile warnings BlockDevices: minor fixes to cleanup compile warnings Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants