Skip to content

Commit

Permalink
dynamic_debug: early return if _ddebug table is empty
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jim Cromie authored and Greg Kroah-Hartman committed Jan 24, 2012
1 parent 820874c commit b5b78f8
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions lib/dynamic_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -871,23 +871,28 @@ static int __init dynamic_debug_init(void)
int ret = 0;
int n = 0;

if (__start___verbose != __stop___verbose) {
iter = __start___verbose;
modname = iter->modname;
iter_start = iter;
for (; iter < __stop___verbose; iter++) {
if (strcmp(modname, iter->modname)) {
ret = ddebug_add_module(iter_start, n, modname);
if (ret)
goto out_free;
n = 0;
modname = iter->modname;
iter_start = iter;
}
n++;
if (__start___verbose == __stop___verbose) {
pr_warn("_ddebug table is empty in a "
"CONFIG_DYNAMIC_DEBUG build");
return 1;
}
iter = __start___verbose;
modname = iter->modname;
iter_start = iter;
for (; iter < __stop___verbose; iter++) {
if (strcmp(modname, iter->modname)) {
ret = ddebug_add_module(iter_start, n, modname);
if (ret)
goto out_free;
n = 0;
modname = iter->modname;
iter_start = iter;
}
ret = ddebug_add_module(iter_start, n, modname);
n++;
}
ret = ddebug_add_module(iter_start, n, modname);
if (ret)
goto out_free;

/* ddebug_query boot param got passed -> set it up */
if (ddebug_setup_string[0] != '\0') {
Expand Down

0 comments on commit b5b78f8

Please sign in to comment.