Commit 65545eae authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

staging: speakup: cleanup spk_var_header_by_name()

There is a confusing while loop here and I have re-written it in
canonical for loop format.  Also I reversed the NULL check on "name" and
pulled everything in one tab stop.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d33bce31
...@@ -137,18 +137,15 @@ struct st_var_header *spk_get_var_header(enum var_id_t var_id) ...@@ -137,18 +137,15 @@ struct st_var_header *spk_get_var_header(enum var_id_t var_id)
struct st_var_header *spk_var_header_by_name(const char *name) struct st_var_header *spk_var_header_by_name(const char *name)
{ {
int i; int i;
struct st_var_header *where = NULL;
if (name != NULL) { if (!name)
i = 0; return NULL;
while ((i < MAXVARS) && (where == NULL)) {
if (strcmp(name, var_ptrs[i]->name) == 0) for (i = 0; i < MAXVARS; i++) {
where = var_ptrs[i]; if (strcmp(name, var_ptrs[i]->name) == 0)
else return var_ptrs[i];
i++;
}
} }
return where; return NULL;
} }
struct var_t *spk_get_var(enum var_id_t var_id) struct var_t *spk_get_var(enum var_id_t var_id)
......
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