diff options
| author | Simon Glass <[email protected]> | 2021-05-13 19:39:20 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2021-07-15 18:42:05 -0400 |
| commit | 7f0f4e1825d1cbc64f6f8cba17f6deb7282acb2b (patch) | |
| tree | 06b82866e5d41cac75afa52b7799ae4c0e3fa47b | |
| parent | ff0494c120be86bb442718f46eac06654d67a5bb (diff) | |
tools: Avoid showing return value of clock_gettime()
This value is either 0 for success or -1 for error. Coverity reports that
"ret" is passed to a parameter that cannot be negative, pointing to the
condition 'if (ret < 0)'.
Adjust it to just check for non-zero and avoid showing -1 in the error
message, which is pointless. Perhaps these changes will molify Coverity.
Reported-by: Coverity (CID: 312956)
Signed-off-by: Simon Glass <[email protected]>
| -rw-r--r-- | tools/image-host.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/image-host.c b/tools/image-host.c index 73095461a79..d3a882ec291 100644 --- a/tools/image-host.c +++ b/tools/image-host.c @@ -329,7 +329,7 @@ static int get_random_data(void *data, int size) { unsigned char *tmp = data; struct timespec date; - int i, ret = 0; + int i, ret; if (!tmp) { printf("%s: pointer data is NULL\n", __func__); @@ -338,9 +338,9 @@ static int get_random_data(void *data, int size) } ret = clock_gettime(CLOCK_MONOTONIC, &date); - if (ret < 0) { - printf("%s: clock_gettime has failed (err=%d, str=%s)\n", - __func__, ret, strerror(errno)); + if (ret) { + printf("%s: clock_gettime has failed (%s)\n", __func__, + strerror(errno)); goto out; } |
