summaryrefslogtreecommitdiff
path: root/examples/device/dfu_runtime/src
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2025-11-05 18:34:09 +0700
committerGitHub <[email protected]>2025-11-05 18:34:09 +0700
commit58b4104015ec10089e8790febe8b3b6cef8b4b09 (patch)
treeb619bbd1b1c002132c4b810d651abfe47b19d9bd /examples/device/dfu_runtime/src
parenta6c16d147593732028ed89292805e0e6a972e4b5 (diff)
parent1f04fe7924e8777c1583323171c0e1cabcb29062 (diff)
Merge pull request #3326 from hathach/fix-code-alerts
Fix code alerts
Diffstat (limited to 'examples/device/dfu_runtime/src')
-rw-r--r--examples/device/dfu_runtime/src/main.c4
-rw-r--r--examples/device/dfu_runtime/src/usb_descriptors.c8
2 files changed, 9 insertions, 3 deletions
diff --git a/examples/device/dfu_runtime/src/main.c b/examples/device/dfu_runtime/src/main.c
index 37cb80093..5de651bcd 100644
--- a/examples/device/dfu_runtime/src/main.c
+++ b/examples/device/dfu_runtime/src/main.c
@@ -132,7 +132,9 @@ void led_blinking_task(void)
static bool led_state = false;
// Blink every interval ms
- if ( board_millis() - start_ms < blink_interval_ms) return; // not enough time
+ if (board_millis() - start_ms < blink_interval_ms) {
+ return; // not enough time
+ }
start_ms += blink_interval_ms;
board_led_write(led_state);
diff --git a/examples/device/dfu_runtime/src/usb_descriptors.c b/examples/device/dfu_runtime/src/usb_descriptors.c
index 1d46ee252..5d5cf52cd 100644
--- a/examples/device/dfu_runtime/src/usb_descriptors.c
+++ b/examples/device/dfu_runtime/src/usb_descriptors.c
@@ -153,14 +153,18 @@ uint16_t const *tud_descriptor_string_cb(uint8_t index, uint16_t langid) {
// Note: the 0xEE index string is a Microsoft OS 1.0 Descriptors.
// https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-defined-usb-descriptors
- if ( !(index < sizeof(string_desc_arr) / sizeof(string_desc_arr[0])) ) return NULL;
+ if (!(index < sizeof(string_desc_arr) / sizeof(string_desc_arr[0]))) {
+ return NULL;
+ }
const char *str = string_desc_arr[index];
// Cap at max char
chr_count = strlen(str);
size_t const max_count = sizeof(_desc_str) / sizeof(_desc_str[0]) - 1; // -1 for string type
- if ( chr_count > max_count ) chr_count = max_count;
+ if (chr_count > max_count) {
+ chr_count = max_count;
+ }
// Convert ASCII string into UTF-16
for ( size_t i = 0; i < chr_count; i++ ) {