diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2013-05-09 21:31:59 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-05-13 18:02:29 -0400 |
commit | 65545eaea9a3af263061e849e3af280b015bc938 (patch) | |
tree | b05f03f3b17e7444ca8c0326a2ca527af3bceb17 /drivers/staging/speakup/varhandlers.c | |
parent | d33bce313cf1a8fbfcd6538fa658bb61840a96ae (diff) | |
download | linux-65545eaea9a3af263061e849e3af280b015bc938.tar.bz2 |
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: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/speakup/varhandlers.c')
-rw-r--r-- | drivers/staging/speakup/varhandlers.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/staging/speakup/varhandlers.c b/drivers/staging/speakup/varhandlers.c index 7f6288fc2299..2e8603d7b14a 100644 --- a/drivers/staging/speakup/varhandlers.c +++ b/drivers/staging/speakup/varhandlers.c @@ -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) { int i; - struct st_var_header *where = NULL; - if (name != NULL) { - i = 0; - while ((i < MAXVARS) && (where == NULL)) { - if (strcmp(name, var_ptrs[i]->name) == 0) - where = var_ptrs[i]; - else - i++; - } + if (!name) + return NULL; + + for (i = 0; i < MAXVARS; i++) { + if (strcmp(name, var_ptrs[i]->name) == 0) + return var_ptrs[i]; } - return where; + return NULL; } struct var_t *spk_get_var(enum var_id_t var_id) |