From d5bc9607f749a241b2491f8f8b07986ba7655350 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 15 Dec 2015 13:57:22 -0800 Subject: [PATCH] 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 --- drivers/staging/greybus/tools/loopback_test.c | 5 +++-- 1 file 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; } -- 2.20.1