mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 04:29:11 -04:00
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>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user