aboutsummaryrefslogtreecommitdiff
path: root/board/ti
diff options
context:
space:
mode:
authorTom Rini2020-06-04 15:45:08 -0400
committerLokesh Vutla2020-06-16 17:00:02 +0530
commite76e85c9f4728e4765c90cef4422d7c9172161c7 (patch)
treeda470caf7cc04c1fcbb9b05ae6935d274d28b0d6 /board/ti
parent5b9ee0fc6f9adb05eefa457a752626cb22cca958 (diff)
board: ti: common: Fix pointer-bool-conversion warnings
When building this code with clang-10 a number of warnings will be generated along the lines of: warning: address of array 'ep->version' will always evaluate to 'true' Convert these checks to checking the strlen of the part of the array we care about. As this array will be null terminated previously by us, this is safe. Cc: Lokesh Vutla <lokeshvutla@ti.com> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Diffstat (limited to 'board/ti')
-rw-r--r--board/ti/common/board_detect.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c
index 429668404a3..e09ecda4d7e 100644
--- a/board/ti/common/board_detect.c
+++ b/board/ti/common/board_detect.c
@@ -669,17 +669,17 @@ void __maybe_unused set_board_info_env(char *name)
if (name)
env_set("board_name", name);
- else if (ep->name)
+ else if (strlen(ep->name) != 0)
env_set("board_name", ep->name);
else
env_set("board_name", unknown);
- if (ep->version)
+ if (strlen(ep->version) != 0)
env_set("board_rev", ep->version);
else
env_set("board_rev", unknown);
- if (ep->serial)
+ if (strlen(ep->serial) != 0)
env_set("board_serial", ep->serial);
else
env_set("board_serial", unknown);
@@ -692,22 +692,22 @@ void __maybe_unused set_board_info_env_am6(char *name)
if (name)
env_set("board_name", name);
- else if (ep->name)
+ else if (strlen(ep->name) != 0)
env_set("board_name", ep->name);
else
env_set("board_name", unknown);
- if (ep->version)
+ if (strlen(ep->version) != 0)
env_set("board_rev", ep->version);
else
env_set("board_rev", unknown);
- if (ep->software_revision)
+ if (strlen(ep->software_revision) != 0)
env_set("board_software_revision", ep->software_revision);
else
env_set("board_software_revision", unknown);
- if (ep->serial)
+ if (strlen(ep->serial) != 0)
env_set("board_serial", ep->serial);
else
env_set("board_serial", unknown);