diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2018-01-27 05:55:10 -0500 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2018-02-19 13:38:51 -0500 |
commit | 584bfe635481d9b2b7f181b05a84d6cfdce79ee7 (patch) | |
tree | f0385138ccb9beb8f27875466a1f463bd477b34f /arch/um/drivers | |
parent | be967f7da50b6d08fbb78a5e4408843a9453ac1b (diff) |
um: vector: Fix an error handling path in 'vector_parse()'
If 'find_device()' finds something, we set '*error_out' and we should
return an error. However, 'err' is known to be 0 at this point.
Explicitly return -EINVAL instead.
While at it, remove the initialization of 'err' at the beginning of the
function and also explicitly return an error code if the first check
fails.
Fixes: ad1f62ab2bd4 ("High Performance UML Vector Network Driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um/drivers')
-rw-r--r-- | arch/um/drivers/vector_kern.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c index 063c76b3a215..4daa4fe18ad7 100644 --- a/arch/um/drivers/vector_kern.c +++ b/arch/um/drivers/vector_kern.c | |||
@@ -677,7 +677,7 @@ static struct vector_device *find_device(int n) | |||
677 | static int vector_parse(char *str, int *index_out, char **str_out, | 677 | static int vector_parse(char *str, int *index_out, char **str_out, |
678 | char **error_out) | 678 | char **error_out) |
679 | { | 679 | { |
680 | int n, len, err = -EINVAL; | 680 | int n, len, err; |
681 | char *start = str; | 681 | char *start = str; |
682 | 682 | ||
683 | len = strlen(str); | 683 | len = strlen(str); |
@@ -686,7 +686,7 @@ static int vector_parse(char *str, int *index_out, char **str_out, | |||
686 | str++; | 686 | str++; |
687 | if (*str != ':') { | 687 | if (*str != ':') { |
688 | *error_out = "Expected ':' after device number"; | 688 | *error_out = "Expected ':' after device number"; |
689 | return err; | 689 | return -EINVAL; |
690 | } | 690 | } |
691 | *str = '\0'; | 691 | *str = '\0'; |
692 | 692 | ||
@@ -699,7 +699,7 @@ static int vector_parse(char *str, int *index_out, char **str_out, | |||
699 | str++; | 699 | str++; |
700 | if (find_device(n)) { | 700 | if (find_device(n)) { |
701 | *error_out = "Device already configured"; | 701 | *error_out = "Device already configured"; |
702 | return err; | 702 | return -EINVAL; |
703 | } | 703 | } |
704 | 704 | ||
705 | *index_out = n; | 705 | *index_out = n; |