cppcheck: added "--enable=warning"

pull/380/head
Daniele Lacamera 2023-10-13 16:08:22 +02:00
parent 5f5b4a5365
commit dcb82b6545
4 changed files with 12 additions and 10 deletions

View File

@ -329,7 +329,7 @@ line-count-x86:
cloc --force-lang-def cloc_lang_def.txt src/boot_x86_fsp.c src/boot_x86_fsp_payload.c src/boot_x86_fsp_start.S src/image.c src/keystore.c src/libwolfboot.c src/loader.c src/string.c src/update_disk.c src/x86/ahci.c src/x86/ata.c src/x86/common.c src/x86/gpt.c src/x86/hob.c src/pci.c src/x86/tgl_fsp.c hal/x86_fsp_tgl.c hal/x86_uart.c
cppcheck:
cppcheck -f --suppress="ctunullpointer" --suppress="nullPointer" --suppress="objectIndex" --suppress="comparePointers" --error-exitcode=89 --std=c89 src/*.c hal/*.c hal/spi/*.c hal/uart/*.c
cppcheck -f --enable=warning --suppress="ctunullpointer" --suppress="nullPointer" --suppress="objectIndex" --suppress="comparePointers" --error-exitcode=89 --std=c89 src/*.c hal/*.c hal/spi/*.c hal/uart/*.c
%.o:%.c
@echo "\t[CC-$(ARCH)] $@"

View File

@ -84,32 +84,32 @@ void RAMFUNCTION stm_gpio_config(uint32_t base, uint32_t pin, uint32_t mode,
RCC_GPIO_CLOCK_ER |= (1 << base_num);
/* Set Mode and Alternate Function */
reg = GPIO_MODE(base) & ~(0x03 << (pin * 2));
reg = GPIO_MODE(base) & ~(0x03UL << (pin * 2));
GPIO_MODE(base) = reg | (mode << (pin * 2));
if (mode < 2) {
if (pin < 8)
GPIO_AFL(base) &= ~(0xf << (pin * 4));
GPIO_AFL(base) &= ~(0xfUL << (pin * 4));
else
GPIO_AFH(base) &= ~(0xf << ((pin - 8) * 4));
GPIO_AFH(base) &= ~(0xfUL << ((pin - 8) * 4));
}
else if (mode == 2) {
/* alternate mode */
if (pin < 8) {
reg = GPIO_AFL(base) & ~(0xf << (pin * 4));
reg = GPIO_AFL(base) & ~(0xfUL << (pin * 4));
GPIO_AFL(base) = reg | (af << (pin * 4));
}
else {
reg = GPIO_AFH(base) & ~(0xf << ((pin - 8) * 4));
reg = GPIO_AFH(base) & ~(0xfUL << ((pin - 8) * 4));
GPIO_AFH(base) = reg | (af << ((pin - 8) * 4));
}
}
/* configure for pull 0=float, 1=pull up, 2=pull down */
reg = GPIO_PUPD(base) & ~(0x03 << (pin * 2));
reg = GPIO_PUPD(base) & ~(0x03UL << (pin * 2));
GPIO_PUPD(base) = reg | (pull << (pin * 2));
/* configure output speed 0=low, 1=med, 2=high, 3=very high */
reg = GPIO_OSPD(base) & ~(0x03 << (pin * 2));
reg = GPIO_OSPD(base) & ~(0x03UL << (pin * 2));
GPIO_OSPD(base) |= (speed << (pin * 2));
}

View File

@ -147,8 +147,10 @@ static UINT64 FileSize(EFI_FILE_HANDLE FileHandle)
UINT64 ret;
FileInfo = LibFileInfo(FileHandle);
if (FileInfo == NULL)
if (FileInfo == NULL) {
panic();
return 0; /* Never reached, for static analyzer */
}
ret = FileInfo->FileSize;
FreePool(FileInfo);

View File

@ -128,7 +128,7 @@ static int RAMFUNCTION wolfBoot_copy_sector(struct wolfBoot_image *src,
{
uint32_t pos = 0;
uint32_t src_sector_offset = (sector * WOLFBOOT_SECTOR_SIZE);
uint32_t dst_sector_offset = (sector * WOLFBOOT_SECTOR_SIZE);
uint32_t dst_sector_offset = src_sector_offset;
#ifdef EXT_ENCRYPTED
uint8_t key[ENCRYPT_KEY_SIZE];
uint8_t nonce[ENCRYPT_NONCE_SIZE];