summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/tools/loopback_test.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@google.com>2015-12-15 13:57:22 -0800
committerGreg Kroah-Hartman <gregkh@google.com>2015-12-17 18:17:07 -0800
commitd5bc9607f749a241b2491f8f8b07986ba7655350 (patch)
treeb3c16a0326fc28affefd156ff8886ae370d75539 /drivers/staging/greybus/tools/loopback_test.c
parent6bfff1dcb2766ebef60a288601ff4cccbb1f6e54 (diff)
greybus: loopback_test: null terminate the dict structure
This lets us test for any number of entries, no need to do an ARRAY_SIZE-type comparison. This fixes a build warning of comparing signed/unsigned values.) Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/tools/loopback_test.c')
-rw-r--r--drivers/staging/greybus/tools/loopback_test.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/staging/greybus/tools/loopback_test.c b/drivers/staging/greybus/tools/loopback_test.c
index 5c2a9fcbd68b..27c733d1c82e 100644
--- a/drivers/staging/greybus/tools/loopback_test.c
+++ b/drivers/staging/greybus/tools/loopback_test.c
@@ -34,7 +34,8 @@ struct dict {
static struct dict dict[] = {
{"ping", 2},
{"transfer", 3},
- {"sink", 4}
+ {"sink", 4},
+ {NULL,} /* list termination */
};
struct loopback_results {
@@ -805,7 +806,7 @@ void loopback_run(struct loopback_test *t)
int i;
int ret;
- for (i = 0; i < sizeof(dict) / sizeof(struct dict); i++) {
+ for (i = 0; dict[i].name != NULL; i++) {
if (strstr(dict[i].name, t->test_name))
t->test_id = dict[i].type;
}