aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dynamic_debug.c
diff options
context:
space:
mode:
authorJim Cromie <jim.cromie@gmail.com>2011-12-19 17:12:54 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2012-01-24 15:48:54 -0500
commitb5b78f83854af15e04c63fdbc6efed9355afbe8f (patch)
treec0f3a85ec25beace9288e6cc9d07723ffeb989fe /lib/dynamic_debug.c
parent820874c75ea0d3a9c22d69d6eaad42a279d6756c (diff)
dynamic_debug: early return if _ddebug table is empty
If _ddebug table is empty (in a CONFIG_DYNAMIC_DEBUG build this shouldn't happen), then warn (error?) and return early. This skips empty table scan and parsing of setup-string, including the pr_info call noting the parse. By inspection, copy return-code handling from 1st ddebug_add_module() callsite to 2nd. Signed-off-by: Jim Cromie <jim.cromie@gmail.com> Signed-off-by: Jason Baron <jbaron@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'lib/dynamic_debug.c')
-rw-r--r--lib/dynamic_debug.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 5a7bacc2e901..4be55d8d76b8 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -871,23 +871,28 @@ static int __init dynamic_debug_init(void)
871 int ret = 0; 871 int ret = 0;
872 int n = 0; 872 int n = 0;
873 873
874 if (__start___verbose != __stop___verbose) { 874 if (__start___verbose == __stop___verbose) {
875 iter = __start___verbose; 875 pr_warn("_ddebug table is empty in a "
876 modname = iter->modname; 876 "CONFIG_DYNAMIC_DEBUG build");
877 iter_start = iter; 877 return 1;
878 for (; iter < __stop___verbose; iter++) { 878 }
879 if (strcmp(modname, iter->modname)) { 879 iter = __start___verbose;
880 ret = ddebug_add_module(iter_start, n, modname); 880 modname = iter->modname;
881 if (ret) 881 iter_start = iter;
882 goto out_free; 882 for (; iter < __stop___verbose; iter++) {
883 n = 0; 883 if (strcmp(modname, iter->modname)) {
884 modname = iter->modname; 884 ret = ddebug_add_module(iter_start, n, modname);
885 iter_start = iter; 885 if (ret)
886 } 886 goto out_free;
887 n++; 887 n = 0;
888 modname = iter->modname;
889 iter_start = iter;
888 } 890 }
889 ret = ddebug_add_module(iter_start, n, modname); 891 n++;
890 } 892 }
893 ret = ddebug_add_module(iter_start, n, modname);
894 if (ret)
895 goto out_free;
891 896
892 /* ddebug_query boot param got passed -> set it up */ 897 /* ddebug_query boot param got passed -> set it up */
893 if (ddebug_setup_string[0] != '\0') { 898 if (ddebug_setup_string[0] != '\0') {