diff options
author | Jim Cromie <jim.cromie@gmail.com> | 2012-04-27 16:30:38 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-30 16:25:39 -0400 |
commit | af442399fcf378a21ffe924b182f6d9ee70001ca (patch) | |
tree | c4489c25edde2f6c4aaeac9eaf2d6d784f6572f9 /lib/dynamic_debug.c | |
parent | 6ab676e96422f33a873006096f928feeded7ce3b (diff) |
dynamic_debug: simplify dynamic_debug_init error exit
We dont want errors while parsing ddebug_query to unload ddebug
tables, so set success after tables are loaded, and return 0 after
query parsing is done.
Simplify error handling code since its no longer used for success,
and change goto label to out_err to clarify this.
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
Acked-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib/dynamic_debug.c')
-rw-r--r-- | lib/dynamic_debug.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 3b06f926d5b8..66e0ec4d21f7 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c | |||
@@ -984,7 +984,7 @@ static int __init dynamic_debug_init(void) | |||
984 | if (strcmp(modname, iter->modname)) { | 984 | if (strcmp(modname, iter->modname)) { |
985 | ret = ddebug_add_module(iter_start, n, modname); | 985 | ret = ddebug_add_module(iter_start, n, modname); |
986 | if (ret) | 986 | if (ret) |
987 | goto out_free; | 987 | goto out_err; |
988 | n = 0; | 988 | n = 0; |
989 | modname = iter->modname; | 989 | modname = iter->modname; |
990 | iter_start = iter; | 990 | iter_start = iter; |
@@ -993,9 +993,11 @@ static int __init dynamic_debug_init(void) | |||
993 | } | 993 | } |
994 | ret = ddebug_add_module(iter_start, n, modname); | 994 | ret = ddebug_add_module(iter_start, n, modname); |
995 | if (ret) | 995 | if (ret) |
996 | goto out_free; | 996 | goto out_err; |
997 | 997 | ||
998 | /* ddebug_query boot param got passed -> set it up */ | 998 | ddebug_init_success = 1; |
999 | |||
1000 | /* apply ddebug_query boot param, dont unload tables on err */ | ||
999 | if (ddebug_setup_string[0] != '\0') { | 1001 | if (ddebug_setup_string[0] != '\0') { |
1000 | pr_warn("ddebug_query param name is deprecated," | 1002 | pr_warn("ddebug_query param name is deprecated," |
1001 | " change it to dyndbg\n"); | 1003 | " change it to dyndbg\n"); |
@@ -1005,9 +1007,6 @@ static int __init dynamic_debug_init(void) | |||
1005 | ddebug_setup_string); | 1007 | ddebug_setup_string); |
1006 | else | 1008 | else |
1007 | pr_info("%d changes by ddebug_query\n", ret); | 1009 | pr_info("%d changes by ddebug_query\n", ret); |
1008 | |||
1009 | /* keep tables even on ddebug_query parse error */ | ||
1010 | ret = 0; | ||
1011 | } | 1010 | } |
1012 | /* now that ddebug tables are loaded, process all boot args | 1011 | /* now that ddebug tables are loaded, process all boot args |
1013 | * again to find and activate queries given in dyndbg params. | 1012 | * again to find and activate queries given in dyndbg params. |
@@ -1021,12 +1020,10 @@ static int __init dynamic_debug_init(void) | |||
1021 | parse_args("dyndbg params", cmdline, NULL, | 1020 | parse_args("dyndbg params", cmdline, NULL, |
1022 | 0, 0, 0, &ddebug_dyndbg_boot_param_cb); | 1021 | 0, 0, 0, &ddebug_dyndbg_boot_param_cb); |
1023 | kfree(cmdline); | 1022 | kfree(cmdline); |
1023 | return 0; | ||
1024 | 1024 | ||
1025 | out_free: | 1025 | out_err: |
1026 | if (ret) | 1026 | ddebug_remove_all_tables(); |
1027 | ddebug_remove_all_tables(); | ||
1028 | else | ||
1029 | ddebug_init_success = 1; | ||
1030 | return 0; | 1027 | return 0; |
1031 | } | 1028 | } |
1032 | /* Allow early initialization for boot messages via boot param */ | 1029 | /* Allow early initialization for boot messages via boot param */ |