Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp85549iog; Wed, 29 Jun 2022 18:45:31 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tdDuIzi3fC/oSB8G6OhMFKCZW8EkNeg5v8xX85xzzty42k9u3FxBcyuyJk2QoBjLecCczN X-Received: by 2002:a17:90a:4744:b0:1ee:dfa1:81ea with SMTP id y4-20020a17090a474400b001eedfa181eamr9001010pjg.5.1656553531076; Wed, 29 Jun 2022 18:45:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656553531; cv=none; d=google.com; s=arc-20160816; b=VwNb0SeE7j4N6p7nudPgen5xcTUwJlnd1yzCloKobjCdVXvcH5J4W4njk1+rMhKcUx jozhj7KajhBxkBMtZhf9naDfK1RsYEcOx/alvBwaUlEomnmZPJ9woFoljRhRTKKnPyjU Y7Y7FseB6Q8FsogPGujrSjKxgI/pNL5KpAAf8KNug3++IgZVX+wO5g5rMAO6b9Rz4Lui 4T0tkE4paNZS7HJhFyoYxV4X0R51vleeQtEymTyZs5z3nFFpGvwzJTFjP7Ri0//IOeou yNA5FnofrIGL0iH7gbqPcq/qc4Y7VT/XBqu3hzeWfpfGB/FDjEni1jMumvJadF+RsCoR PR1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Vt4d3ZPkxd6x06NJs20vg1HDeiZRC5b8YSDwwTqf6Aw=; b=ustBVVYH4Ez3y1MQPilDPquJkZdGFfmST93uBTkogWxknXYo3Reah8ZYTT8DENVCLb QnG3mOw/AE9E4Vp/PLbQEM/S6KB/1/NycDSj+Zfs77KSyjQFonpDUyrX4oNQUq4C9P2t YVdhuLrEVXuHL4zSGpbRedrQaST6C/0FsCC0fNUbdbYn707NKv/LJ1FnpMuoUseLl9F/ GfnktFDlr9Kbw0JAlgXeg/Bu8bCMFYeupOVaBlQOpR1cCzCHOiMyB5bbVpIYz7LQFmPR g4JkQjKHDZAnoEYDU0QOOuLXAAZVLmvfOE8T8lk256tJdZCUW+XxQ/HvJ6ZVoCibRU6m V0mQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e8-20020a056a001a8800b0052542cfb5c4si3457023pfv.235.2022.06.29.18.45.19; Wed, 29 Jun 2022 18:45:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230030AbiF3BeK (ORCPT + 99 others); Wed, 29 Jun 2022 21:34:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229560AbiF3BeJ (ORCPT ); Wed, 29 Jun 2022 21:34:09 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B7331C128; Wed, 29 Jun 2022 18:34:08 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4LYLSj06Xcz9sv3; Thu, 30 Jun 2022 09:33:25 +0800 (CST) Received: from dggpeml100012.china.huawei.com (7.185.36.121) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 30 Jun 2022 09:34:06 +0800 Received: from ubuntu1804.huawei.com (10.67.174.66) by dggpeml100012.china.huawei.com (7.185.36.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 30 Jun 2022 09:34:06 +0800 From: Zheng Yejian To: , , , , CC: , , Subject: [PATCH] tracing/histograms: Simplify create_hist_fields() Date: Thu, 30 Jun 2022 09:31:52 +0800 Message-ID: <20220630013152.164871-1-zhengyejian1@huawei.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.66] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml100012.china.huawei.com (7.185.36.121) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When I look into implements of create_hist_fields(), I think there can be following two simplifications: 1. If something wrong happened in parse_var_defs(), free_var_defs() would have been called in it, so no need goto free again after calling it; 2. After calling create_key_fields(), regardless of the value of 'ret', it then always runs into 'out: ', so the judge of 'ret' is redundant. No functional changes. Signed-off-by: Zheng Yejian --- kernel/trace/trace_events_hist.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index 2784951e0fc8..832c4ccf41ab 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -4454,7 +4454,7 @@ static int create_hist_fields(struct hist_trigger_data *hist_data, ret = parse_var_defs(hist_data); if (ret) - goto out; + return ret; ret = create_val_fields(hist_data, file); if (ret) @@ -4465,8 +4465,7 @@ static int create_hist_fields(struct hist_trigger_data *hist_data, goto out; ret = create_key_fields(hist_data, file); - if (ret) - goto out; + out: free_var_defs(hist_data); -- 2.32.0