summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorEvan Green <evgreen@chromium.org>2019-09-23 13:19:18 -0700
committerCommit Bot <commit-bot@chromium.org>2019-10-05 00:47:52 +0000
commit7200037dfc674977bffc3d58a15547d97f3ef681 (patch)
treee9b7630db4f17ec7bf6fbaf01322a05ff0ee6419 /common
parent2eade31e87a7662dc03dcead556917dfa13d0983 (diff)
downloadchrome-ec-7200037dfc674977bffc3d58a15547d97f3ef681.tar.gz
printf: Fix formatting errors
This change fixes the printf formatting errors found by the compile-time prinf format checker. The errors fall into a few categories: 1. Incorrect size specifier (missing or extra l). 2. Missing or extra arguments. 3. Bad line splitting. BUG=chromium:984041 TEST=make -j buildall BRANCH=none Change-Id: I5618097a581210b9fcbfc81560dec050ae30b61c Signed-off-by: Evan Green <evgreen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1819653 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/bluetooth_le.c2
-rw-r--r--common/btle_ll.c2
-rw-r--r--common/console_output.c2
-rw-r--r--common/factory_mode.c2
-rw-r--r--common/motion_sense.c6
-rw-r--r--common/nvmem.c2
-rw-r--r--common/panic_output.c4
-rw-r--r--common/system.c5
-rw-r--r--common/usbc/usb_sm.c5
9 files changed, 16 insertions, 14 deletions
diff --git a/common/bluetooth_le.c b/common/bluetooth_le.c
index 5e611d1dd1..94d006781d 100644
--- a/common/bluetooth_le.c
+++ b/common/bluetooth_le.c
@@ -139,7 +139,7 @@ static void mem_dump(uint8_t *mem, int len)
for (i = 0; i < len; i++) {
value = mem[i];
if (i % 8 == 0)
- CPRINTF("\n%08x: %02x", &mem[i], value);
+ CPRINTF("\n%08lx: %02x", (unsigned long)&mem[i], value);
else
CPRINTF(" %02x", value);
}
diff --git a/common/btle_ll.c b/common/btle_ll.c
index ef081b9526..cecbb3058a 100644
--- a/common/btle_ll.c
+++ b/common/btle_ll.c
@@ -846,7 +846,7 @@ void bluetooth_ll_task(void)
if (ll_state == STANDBY) {
CPRINTF("Exiting connection state/Entering "
- "Standby state after %d connections ",
+ "Standby state after %d connections "
"events\n", ll_conn_events);
print_connection_state();
}
diff --git a/common/console_output.c b/common/console_output.c
index 86072d9b62..fb6e91a368 100644
--- a/common/console_output.c
+++ b/common/console_output.c
@@ -147,7 +147,7 @@ static int command_ch(int argc, char **argv)
/* Print the list of channels */
ccputs(" # Mask E Channel\n");
for (i = 0; i < CC_CHANNEL_COUNT; i++) {
- ccprintf("%2d %08x %c %s\n",
+ ccprintf("%2d %08lx %c %s\n",
i, CC_MASK(i),
(channel_mask & CC_MASK(i)) ? '*' : ' ',
channel_names[i]);
diff --git a/common/factory_mode.c b/common/factory_mode.c
index 9198cc936c..c1d6789b91 100644
--- a/common/factory_mode.c
+++ b/common/factory_mode.c
@@ -43,7 +43,7 @@ DECLARE_HOOK(HOOK_CCD_CHANGE, ccd_config_changed, HOOK_PRIO_LAST);
static void force_system_reset(void)
{
- CPRINTS("%s: ccd hook didn't reset the system");
+ CPRINTS("ccd hook didn't reset the system");
factory_config_saved(0);
}
DECLARE_DEFERRED(force_system_reset);
diff --git a/common/motion_sense.c b/common/motion_sense.c
index ef9cdef185..73659ab161 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -155,11 +155,11 @@ int motion_sense_set_data_rate(struct motion_sensor_t *sensor)
return ret;
#ifdef CONFIG_CONSOLE_VERBOSE
- CPRINTS("%s ODR: %d - roundup %d from config %d [AP %d]",
+ CPRINTS("%s ODR: %d - roundup %d from config %d [AP %ld]",
sensor->name, odr, roundup, config_id,
BASE_ODR(sensor->config[SENSOR_CONFIG_AP].odr));
#else
- CPRINTS("%c%d ODR %d rup %d cfg %d AP %d",
+ CPRINTS("%c%d ODR %d rup %d cfg %d AP %ld",
sensor->name[0], sensor->type, odr, roundup, config_id,
BASE_ODR(sensor->config[SENSOR_CONFIG_AP].odr));
#endif
@@ -1669,7 +1669,7 @@ static int command_display_accel_info(int argc, char **argv)
ccprintf("max_freq: %d\n", motion_sensors[i].max_frequency);
ccprintf("config:\n");
for (j = 0; j < SENSOR_CONFIG_MAX; j++) {
- ccprintf("%d - odr: %umHz, ec_rate: %uus\n", j,
+ ccprintf("%d - odr: %lumHz, ec_rate: %uus\n", j,
motion_sensors[i].config[j].odr &
~ROUND_UP_FLAG,
motion_sensors[i].config[j].ec_rate);
diff --git a/common/nvmem.c b/common/nvmem.c
index 77c3fe2040..4b4d8fc590 100644
--- a/common/nvmem.c
+++ b/common/nvmem.c
@@ -464,7 +464,7 @@ void nvmem_disable_commits(void)
int nvmem_commit(void)
{
if (nvmem_mutex.task == TASK_ID_COUNT) {
- CPRINTF("%s: attempt to commit in unlocked state\n",
+ CPRINTF("%s: attempt to commit in unlocked state %d\n",
__func__, nvmem_mutex.task);
return EC_ERROR_OVERFLOW; /* Noting to commit. */
}
diff --git a/common/panic_output.c b/common/panic_output.c
index 8188cea299..e8233d75cc 100644
--- a/common/panic_output.c
+++ b/common/panic_output.c
@@ -194,12 +194,12 @@ static int command_crash(int argc, char **argv)
volatile int zero = 0;
cflush();
- ccprintf("%08x", (long)1 / zero);
+ ccprintf("%08lx", (long)1 / zero);
} else if (!strcasecmp(argv[1], "udivzero")) {
volatile int zero = 0;
cflush();
- ccprintf("%08x", (unsigned long)1 / zero);
+ ccprintf("%08lx", (unsigned long)1 / zero);
#ifdef CONFIG_CMD_STACKOVERFLOW
} else if (!strcasecmp(argv[1], "stack")) {
stack_overflow_recurse(1);
diff --git a/common/system.c b/common/system.c
index 074ae24af7..7b8b164ea5 100644
--- a/common/system.c
+++ b/common/system.c
@@ -365,8 +365,9 @@ void system_disable_jump(void)
*/
ret = mpu_protect_data_ram();
if (ret == EC_SUCCESS) {
- CPRINTS("data RAM locked. Exclusion %08x-%08x",
- &__iram_text_start, &__iram_text_end);
+ CPRINTS("data RAM locked. Exclusion %08lx-%08lx",
+ (unsigned long)&__iram_text_start,
+ (unsigned long)&__iram_text_end);
} else {
CPRINTS("Failed to lock data RAM (%d)", ret);
return;
diff --git a/common/usbc/usb_sm.c b/common/usbc/usb_sm.c
index 3419bf5bb1..ce7c24b332 100644
--- a/common/usbc/usb_sm.c
+++ b/common/usbc/usb_sm.c
@@ -115,8 +115,9 @@ void set_state(const int port, struct sm_ctx *const ctx,
* intended state to transition into.
*/
if (internal->exit) {
- CPRINTF("C%d: Ignoring set state to 0x%08x within 0x%08x",
- port, new_state, ctx->current);
+ CPRINTF("C%d: Ignoring set state to 0x%08lx within 0x%08lx",
+ port, (unsigned long)new_state,
+ (unsigned long)ctx->current);
return;
}