提交 b5b78f83 编写于 作者: J Jim Cromie 提交者: Greg Kroah-Hartman

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: NJim Cromie <jim.cromie@gmail.com>
Signed-off-by: NJason Baron <jbaron@redhat.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 820874c7
...@@ -871,23 +871,28 @@ static int __init dynamic_debug_init(void) ...@@ -871,23 +871,28 @@ static int __init dynamic_debug_init(void)
int ret = 0; int ret = 0;
int n = 0; int n = 0;
if (__start___verbose != __stop___verbose) { if (__start___verbose == __stop___verbose) {
iter = __start___verbose; pr_warn("_ddebug table is empty in a "
modname = iter->modname; "CONFIG_DYNAMIC_DEBUG build");
iter_start = iter; return 1;
for (; iter < __stop___verbose; iter++) { }
if (strcmp(modname, iter->modname)) { iter = __start___verbose;
ret = ddebug_add_module(iter_start, n, modname); modname = iter->modname;
if (ret) iter_start = iter;
goto out_free; for (; iter < __stop___verbose; iter++) {
n = 0; if (strcmp(modname, iter->modname)) {
modname = iter->modname; ret = ddebug_add_module(iter_start, n, modname);
iter_start = iter; if (ret)
} goto out_free;
n++; 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 */ /* ddebug_query boot param got passed -> set it up */
if (ddebug_setup_string[0] != '\0') { if (ddebug_setup_string[0] != '\0') {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册