Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp958055pxj; Fri, 4 Jun 2021 02:28:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvWIAHUsVt80fM4a/WjaH1oou2j4epUCNkYgdna7WIypHD3LdvDbusxU9LLEiRGol4foi7 X-Received: by 2002:a17:906:6ad0:: with SMTP id q16mr3427444ejs.286.1622798938727; Fri, 04 Jun 2021 02:28:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622798938; cv=none; d=google.com; s=arc-20160816; b=Ar7SW2F6Bti1iwdR2yQWAz6icyWGGoAzQibFJvXQRzQhcQbQcFI7Ro6ncb1sgOeAxd T/ZS8fMGkNMdwrADFCFUtjzneN8cwHVZ0yY74CW6NWLdezdjCCKaiXPswTiy/hOWF25n gjgQmFVO9rIod4sgLdFdJudg127ElbseQ1c0PmV8j553qoza6i27FavD8JtERI2I11/q spUnCMj35o0aQuWcRxQxVeZiDMHKdES/rD+a6OB+F3pPW90xii64oC3Ht8Cy5+0oe8z9 JTilAW8iQhL+Z9qBEzl1ZWnY5Z0YW2IlL6+0QWl1k9e4Sacv1evE2oTGdjWKJMUNr+Ar HkgA== 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:dkim-signature; bh=v4s7Wdp9P+q1iZfuGGxYhUoU58bq9Dm8LlurM2nZ904=; b=ZaIrazdvN+njsedlLvaf9l2eHlWoI5ocOlHMD0xSVVNvvYYOFQdH89DbMtYebjqBpt eonfvzYA701e7cs32rfHs+FBH9c+xKZhw5+X6JINxrtztanuPD2z6OeY4ze4pCmIx0+m RzM7DjpQbZ2l5muIhjt9rVLnQGJg/55bbqi8+p4yENQRBSGbdVTOCpD+BdW52/9+19xa OIPtS5pg1PhrvQ629MUd0TxIoWffRtkfEyEjnCsquSLdOgPjIBr1llN/CyvQksHP6wDz +7mc+PE3tBGMT7QTVOlljjq9mvReoqvI/JbDr7EX0OvAWMra0eoEQNYBYB2P6ntuAuUn 4rVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=IbVRCbVi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m19si4925839edd.490.2021.06.04.02.28.34; Fri, 04 Jun 2021 02:28:58 -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; dkim=pass header.i=@chromium.org header.s=google header.b=IbVRCbVi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229963AbhFDJ32 (ORCPT + 99 others); Fri, 4 Jun 2021 05:29:28 -0400 Received: from mail-ed1-f54.google.com ([209.85.208.54]:38759 "EHLO mail-ed1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229958AbhFDJ31 (ORCPT ); Fri, 4 Jun 2021 05:29:27 -0400 Received: by mail-ed1-f54.google.com with SMTP id o5so10377147edc.5 for ; Fri, 04 Jun 2021 02:27:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=v4s7Wdp9P+q1iZfuGGxYhUoU58bq9Dm8LlurM2nZ904=; b=IbVRCbVi0TMLMZSOQCIoI6xN2Rk8hy4/iQ7Vg+2pMSUrilCtVQDK6uK6OyCqxzGLKW WdR5yT9nqflcvKcaHipGwqPpuU6t9iVvTPHF6HnQGtfAE3h5SBxQFZlmqcRkMB+DN+sk 0G9TVefGF74xLo8BqBWJxN48XMpcg8fjfMJv8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=v4s7Wdp9P+q1iZfuGGxYhUoU58bq9Dm8LlurM2nZ904=; b=uFOZCDoBRqRSxsqhNd8YR2rF21cFK7WTT/21hMyN+Bf1RPTPp8bDAqwY97HUiDc3N0 mrD79z3pTEUOLrNHBvNu1VSm6RIyzVXze03fO2i2w7Q3Zs5O67e+Z0ih5700mCBztzyq YQUqrhZ/B2VzV4QOq1hKYS7o5W3QMqWzzVXGrGVF8nmVX+/tqaLVg/q5UQ+8A5puFxpz Jy9mJLOu+LDa/RDQQYbs9EcNP0wewmwLlePvdSVKDmrD3WQfI0qsTbjI/KG90jPfXLO2 idbhRDY3L+WqrZBfME0XKwYNagdJNboK/fXR/+UMtcslq6O0RD8EBAfWmm2vsr/omUIx sp6w== X-Gm-Message-State: AOAM533N8l6IGIILXiaQTiQ0vytpYdixsvmq+K5NK3gvpMPMFmhwl80j pSndfBRxvb/pxEWkbUfW42SUbCm/5z7Oc0iG X-Received: by 2002:aa7:db90:: with SMTP id u16mr3695449edt.106.1622798800833; Fri, 04 Jun 2021 02:26:40 -0700 (PDT) Received: from alco.lan ([80.71.134.83]) by smtp.gmail.com with ESMTPSA id z22sm2095405ejm.71.2021.06.04.02.26.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Jun 2021 02:26:40 -0700 (PDT) From: Ricardo Ribalda To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo Cc: Ricardo Ribalda Subject: [PATCH] tools/perf: Do not set a variable unless it will be used Date: Fri, 4 Jun 2021 11:26:38 +0200 Message-Id: <20210604092638.985694-1-ribalda@chromium.org> X-Mailer: git-send-email 2.32.0.rc1.229.g3e70b5a671-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org clang-13 triggers the following warning: bench/inject-buildid.c:351:6: error: variable 'len' set but not used [-Werror,-Wunused-but-set-variable] u64 len = 0; This patch sets the value to len only if it will be used afterwards. Signed-off-by: Ricardo Ribalda --- tools/perf/bench/inject-buildid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/bench/inject-buildid.c b/tools/perf/bench/inject-buildid.c index 55d373b75791..fee69ac787b2 100644 --- a/tools/perf/bench/inject-buildid.c +++ b/tools/perf/bench/inject-buildid.c @@ -348,13 +348,13 @@ static int inject_build_id(struct bench_data *data, u64 *max_rss) int status; unsigned int i, k; struct rusage rusage; - u64 len = 0; + u64 len; /* this makes the child to run */ if (perf_header__write_pipe(data->input_pipe[1]) < 0) return -1; - len += synthesize_attr(data); + len = synthesize_attr(data); len += synthesize_fork(data); for (i = 0; i < nr_mmaps; i++) { -- 2.32.0.rc1.229.g3e70b5a671-goog