Fixed more alert found by PVS-Studio

This commit is contained in:
hathach
2025-11-03 16:36:07 +07:00
parent 22f01aea0d
commit 8979af34c0
25 changed files with 224 additions and 208 deletions

View File

@ -51,8 +51,7 @@ int sys_read(int fhdl, char *buf, size_t count) TU_ATTR_USED;
int sys_write(int fhdl, const char *buf, size_t count) {
(void) fhdl;
SEGGER_RTT_Write(0, buf, (int) count);
return (int) count;
return (int) SEGGER_RTT_Write(0, buf, (int) count);
}
int sys_read(int fhdl, char *buf, size_t count) {
@ -159,7 +158,7 @@ int board_getchar(void) {
}
void board_putchar(int c) {
sys_write(0, (const char*)&c, 1);
(void) sys_write(0, (const char*)&c, 1);
}
uint32_t tusb_time_millis_api(void) {

View File

@ -165,7 +165,7 @@ static inline size_t board_usb_get_serial(uint16_t desc_str1[], size_t max_chars
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
};
const uint8_t nibble = (uint8_t) ((uid[i] >> (j * 4)) & 0xf);
const uint8_t nibble = (uint8_t) ((uid[i] >> (j * 4u)) & 0xfu);
desc_str1[i * 2 + (1 - j)] = nibble_to_hex[nibble]; // UTF-16-LE
}
}