lkml.org 
[lkml]   [2011]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 22/26] dynamic_debug: early return if _ddebug table is empty
    Date
    From: Jim Cromie <jim.cromie@gmail.com>

    if _ddebug table is empty (which shouldn't happen in a CONFIG_DYNAMIC_DEBUG
    build), then warn (BUILD_BUG??) and return early. This skips empty
    table scan and parsing of setup-string, including the pr_info call
    noting the parse.

    Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
    ---
    lib/dynamic_debug.c | 32 +++++++++++++++++---------------
    1 files changed, 17 insertions(+), 15 deletions(-)

    diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
    index 80b5322..1a8941e 100644
    --- a/lib/dynamic_debug.c
    +++ b/lib/dynamic_debug.c
    @@ -1272,23 +1272,25 @@ 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);

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


    \
     
     \ /
      Last update: 2011-09-22 00:05    [W:0.020 / U:0.084 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site