From a03de29ec11e96b0bec6104689002e15ccb9add5 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Mon, 2 Sep 2019 14:16:46 +0200 Subject: util/uut: Fix printf formats Found by Coverity Scan #1194{41,48,49,50,53,54,55} BUG=none BRANCH=none TEST=none Change-Id: I8fee672359f7b13639d09e603f3aaa11de05e820 Signed-off-by: Patrick Georgi Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1781468 Reviewed-by: Daisuke Nojiri Tested-by: Patrick Georgi Commit-Queue: Patrick Georgi --- util/uut/l_com_port.c | 12 ++++++------ util/uut/main.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/util/uut/l_com_port.c b/util/uut/l_com_port.c index 8f9a51517a..018dec9950 100644 --- a/util/uut/l_com_port.c +++ b/util/uut/l_com_port.c @@ -102,7 +102,7 @@ void set_read_blocking(int dev_drv, bool block) if (tcgetattr(dev_drv, &tty) != 0) { display_color_msg(FAIL, "set_read_blocking Error: %d Fail to get attribute " - "from Device number %lu.\n", + "from Device number %d.\n", errno, dev_drv); return; } @@ -113,7 +113,7 @@ void set_read_blocking(int dev_drv, bool block) if (tcsetattr(dev_drv, TCSANOW, &tty) != 0) { display_color_msg(FAIL, "set_read_blocking Error: %d Fail to set attribute to " - "Device number %lu.\n", + "Device number %d.\n", errno, dev_drv); } } @@ -147,7 +147,7 @@ bool com_config_uart(int h_dev_drv, struct comport_fields com_port_fields) if (tcgetattr(h_dev_drv, &tty) != 0) { display_color_msg(FAIL, "com_config_uart Error: Fail to get attribute from " - "Device number %lu.\n", + "Device number %d.\n", h_dev_drv); return false; } @@ -389,7 +389,7 @@ uint32_t com_port_read_bin(int device_id, uint8_t *buffer, uint32_t buf_size) if (read_bytes == -1) { display_color_msg(FAIL, - "%s() Error: %d Device number %lu was not " + "%s() Error: %d Device number %u was not " "opened, %s.\n", __func__, errno, (uint32_t)device_id, strerror(errno)); } @@ -423,7 +423,7 @@ uint32_t com_port_wait_read(int device_id) ret_val = poll(&fds, 1, COMMAND_TIMEOUT); if (ret_val < 0) { display_color_msg(FAIL, - "%s() Error: %d Device number %lu %s\n", + "%s() Error: %d Device number %u %s\n", __func__, errno, (uint32_t)device_id, strerror(errno)); return 0; } @@ -436,7 +436,7 @@ uint32_t com_port_wait_read(int device_id) if (ioctl(device_id, FIONREAD, &bytes) < 0) { display_color_msg(FAIL, "com_port_wait_for_read() Error: %d Device number " - "%lu %s\n", + "%u %s\n", errno, (uint32_t)device_id, strerror(errno)); return 0; } diff --git a/util/uut/main.c b/util/uut/main.c index ff3a3066fd..3ac8032739 100644 --- a/util/uut/main.c +++ b/util/uut/main.c @@ -376,7 +376,7 @@ int main(int argc, char *argv[]) * for timeout due to unstable data transfer yet. */ display_color_msg(FAIL, - "Host/Device synchronization failed, error = %lu," + "Host/Device synchronization failed, error = %d," " fail count = %d\n", sr, sync_cnt); } if (sync_cnt > MAX_SYNC_RETRIES) -- cgit v1.2.1