Commit d5bc9607 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 6bfff1dc
...@@ -34,7 +34,8 @@ struct dict { ...@@ -34,7 +34,8 @@ struct dict {
static struct dict dict[] = { static struct dict dict[] = {
{"ping", 2}, {"ping", 2},
{"transfer", 3}, {"transfer", 3},
{"sink", 4} {"sink", 4},
{NULL,} /* list termination */
}; };
struct loopback_results { struct loopback_results {
...@@ -805,7 +806,7 @@ void loopback_run(struct loopback_test *t) ...@@ -805,7 +806,7 @@ void loopback_run(struct loopback_test *t)
int i; int i;
int ret; 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)) if (strstr(dict[i].name, t->test_name))
t->test_id = dict[i].type; t->test_id = dict[i].type;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment