Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp536179ybg; Tue, 9 Jun 2020 06:54:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSDXEtcWjwN5dy90p7VyLpLiHuCTc3f7OBxmPJ/GFVVLZmpU3prGC6Cnd7Le/sVuJi3/fm X-Received: by 2002:a17:906:d1c5:: with SMTP id bs5mr26218522ejb.117.1591710871306; Tue, 09 Jun 2020 06:54:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591710871; cv=none; d=google.com; s=arc-20160816; b=v+AdfI8qbdcHqGRsJnzkHMpmUfk0Yw47SyK97K6zEreuY3x3a6ZdXv1JzNkXFUECAx hgzMlBlvYM8Qe80O63I7kbBQ7S3Q69/6s5YpSeAcWy4kkL3rVL4WS2TpKHS+07qvJYAV XIfnAe+9mlsn6x9NkeNL118esKeXU59BCPT9AWHLE70uO7hsXck7iazAqACofuRqoCjV 8P51seROLuKMHfildx/v48gtdd/2vidEC7rdOfGl7emsuDgN9twFfHDA+/LBhexob2uv KacgXSOMFKdZeJSCSn2k4CAs/j/8xWmvQu8JoWxCbwl7AIrJWX2WBxZ4ZcyRyavgj9XJ hmUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=48n6dUirZDeiYEwxNgdN9VuB4AjpOMHhBbQC/c1rFlg=; b=DJJBKDXVFxGF4za+7LZ4q4ix9nnZ0XMZChQxObPJleVOo6RIPKiPElMMi/wE78Q/pg 3rkVhuD1wKhcGjigRtvnDjsDcB+gwUSHoy3DnI11iG3qZb5af1cEh/W7tEJzQypS2b3P m0F4ffPAVuEigYJBsAAD6Z6G6qkABguy5rDknQBmlMJ177P6cKj+Bf57xHwyoj/MnnZG rJBNhWCK7Tf+omoAzKb56IoZ1rBevBSFkTF35BBvqUebz8o3xO02yG37691Ybb6cjMpa CKZT8mkLkVz8iLIf1CxhJ93SwuOUqFXFm5rb7WWiTnKX+/cCWtRcDkWVIbS0gZnBe7ah RwZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t13si11236360edj.100.2020.06.09.06.54.09; Tue, 09 Jun 2020 06:54:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730244AbgFINvf (ORCPT + 99 others); Tue, 9 Jun 2020 09:51:35 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:42766 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728388AbgFINvf (ORCPT ); Tue, 9 Jun 2020 09:51:35 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id BCC10FDE7730327D72A8; Tue, 9 Jun 2020 21:51:32 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.487.0; Tue, 9 Jun 2020 21:51:24 +0800 From: Kefeng Wang To: Divya Indi , CC: Steven Rostedt , Aruna Ramakrishna , Kefeng Wang Subject: [PATCH] sample-trace-array: Remove trace_array 'sample-instance' Date: Tue, 9 Jun 2020 13:52:00 +0000 Message-ID: <20200609135200.2206726-1-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.112.125] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove trace_array 'sample-instance' if kthread_run fails in sample_trace_array_init(). Signed-off-by: Kefeng Wang --- 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.27.0