lkml.org 
[lkml]   [2020]   [Jun]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[for-linus][PATCH 08/17] sample-trace-array: Remove trace_array sample-instance
    From: Kefeng Wang <wangkefeng.wang@huawei.com>

    Remove trace_array 'sample-instance' if kthread_run fails
    in sample_trace_array_init().

    Link: https://lkml.kernel.org/r/20200609135200.2206726-1-wangkefeng.wang@huawei.com

    Cc: stable@vger.kernel.org
    Fixes: 89ed42495ef4a ("tracing: Sample module to demonstrate kernel access to Ftrace instances.")
    Reviewed-by: Divya Indi <divya.indi@oracle.com>
    Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
    Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
    ---
    samples/ftrace/sample-trace-array.c | 6 +++++-
    1 file changed, 5 insertions(+), 1 deletion(-)

    diff --git a/samples/ftrace/sample-trace-array.c b/samples/ftrace/sample-trace-array.c
    index 9e437f930280..6aba02a31c96 100644
    --- a/samples/ftrace/sample-trace-array.c
    +++ b/samples/ftrace/sample-trace-array.c
    @@ -115,8 +115,12 @@ static int __init sample_trace_array_init(void)
    trace_printk_init_buffers();

    simple_tsk = kthread_run(simple_thread, NULL, "sample-instance");
    - if (IS_ERR(simple_tsk))
    + if (IS_ERR(simple_tsk)) {
    + trace_array_put(tr);
    + trace_array_destroy(tr);
    return -1;
    + }
    +
    return 0;
    }

    --
    2.26.2

    \
     
     \ /
      Last update: 2020-06-19 01:57    [W:3.301 / U:0.436 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site