1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 11:29:58 +03:00

Fix compiler errors if you remove -flto=auto from standard build flags (#14381)

This commit is contained in:
mjs1441 2025-05-13 19:35:05 +01:00 committed by GitHub
parent 0136c5a54c
commit a98645b44a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 4 deletions

View file

@ -306,7 +306,7 @@ FAST_CODE_NOINLINE void updateDshotTelemetry(void)
return; return;
} }
const unsigned motorCount = dshotMotorCount; const unsigned motorCount = MIN(MAX_SUPPORTED_MOTORS, dshotMotorCount);
uint32_t erpmTotal = 0; uint32_t erpmTotal = 0;
uint32_t rpmSamples = 0; uint32_t rpmSamples = 0;

View file

@ -38,8 +38,10 @@ PG_REGISTER_WITH_RESET_FN(boardConfig_t, boardConfig, PG_BOARD_CONFIG, 0);
void pgResetFn_boardConfig(boardConfig_t *boardConfig) void pgResetFn_boardConfig(boardConfig_t *boardConfig)
{ {
if (boardInformationIsSet()) { if (boardInformationIsSet()) {
strncpy(boardConfig->manufacturerId, getManufacturerId(), MAX_MANUFACTURER_ID_LENGTH + 1); strncpy(boardConfig->manufacturerId, getManufacturerId(), sizeof(boardConfig->manufacturerId) - 1);
strncpy(boardConfig->boardName, getBoardName(), MAX_BOARD_NAME_LENGTH + 1); boardConfig->manufacturerId[sizeof(boardConfig->manufacturerId) - 1] = 0; // ensure zero-termination of string
strncpy(boardConfig->boardName, getBoardName(), sizeof(boardConfig->boardName) - 1);
boardConfig->boardName[sizeof(boardConfig->boardName) - 1] = 0; // ensure zero-termination of string
boardConfig->boardInformationSet = true; boardConfig->boardInformationSet = true;
} else { } else {
boardConfig->boardInformationSet = false; boardConfig->boardInformationSet = false;

View file

@ -1359,7 +1359,7 @@ SD_Error_t SD_GetCardStatus(SD_CardStatus_t* pCardStatus)
static SD_Error_t SD_PowerON(void) static SD_Error_t SD_PowerON(void)
{ {
SD_Error_t ErrorState; SD_Error_t ErrorState;
uint32_t Response; uint32_t Response = 0; // Avoid (invalid) maybe-unitialized compiler error.
uint32_t Count; uint32_t Count;
uint32_t ValidVoltage; uint32_t ValidVoltage;
uint32_t SD_Type; uint32_t SD_Type;