Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp698089ybg; Thu, 19 Mar 2020 07:13:20 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtwn3OgRqN+C0VjE5T2AbGSi7tiD7Qf685WtFvanBCB+Df5PNIE56DwFg/Bnn/M7robiwXt X-Received: by 2002:a9d:3ea4:: with SMTP id b33mr2416419otc.136.1584627200353; Thu, 19 Mar 2020 07:13:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584627200; cv=none; d=google.com; s=arc-20160816; b=L+dL9pO2pLlIpICgIU+87eOKb4ZPOCblGGOwSDqOkl6SPVJBfqmYIOmjNVCsdCx4vz sDs0spSZIbONktLAIf8kjDLq0CmXsGSoHhoJAJy+fGEVl8xP6HjHBU5ld1uVg8mJyvit GB9KVbegie64LJwYbSyuCVp40e6cUgrEHIr99Gy/5fxFetNkx0wQqT1CFNBGD7c9G5Ym BqFISD0TG5I4rw1c5jdvH/8e/YHgqJYeI/gyCZ+TK56YgscL3Ic54WhCpjXR2gOMdQx4 wMeWE6xuGzgGELYCmgySZiSs2gyi174MyrQOj3BADcIq5L7KzeIaduqOnoHgu//kEOUw 7bwg== 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 :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=SgSfVaohsv+I7Dg6DH1K+gdakDI0GxWpyJzoc8tjxoU=; b=MDHHGYg+neJ0lkqAawgEfJLw4E0979YQv4VP5tReAfKvNYwAbqCP5COprMA+DJOfG0 SE5j9niNRPgOFld1ru59hBa8gAin8Dqlra86Zj4z2H0m5ZJ6iy2O4UUiA3oYyl8n6PSu c6tdUa+J28kJm0Ft54J3XggkEXOy16pqZqz/6NXSh5pYKlnT/EL4qwQvfRElsTpFgu5M yKfML/OXJqq0ABQHude/1ZMR7OVIClGL5VMZ1QRWzWWNKlNIyoxSLTY/+EWx/K5sZnmv 1dMU/vm083TfTYZwVX+gr2Vb3wvK8Ud2m7u/eq2XTiD0mvD+y3h+SeC6LmHk40AY9jAl 6qHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y17si1312177oto.70.2020.03.19.07.12.58; Thu, 19 Mar 2020 07:13:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728251AbgCSOMA (ORCPT + 99 others); Thu, 19 Mar 2020 10:12:00 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:32858 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727964AbgCSOLN (ORCPT ); Thu, 19 Mar 2020 10:11:13 -0400 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jEvsu-0002DH-Ve; Thu, 19 Mar 2020 15:10:57 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 96F6C1C22AA; Thu, 19 Mar 2020 15:10:50 +0100 (CET) Date: Thu, 19 Mar 2020 14:10:50 -0000 From: "tip-bot2 for Jiri Olsa" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf expr: Make expr__parse() return -1 on error Cc: Jiri Olsa , Andi Kleen , Alexander Shishkin , John Garry , Kajol Jain , Michael Petlan , Namhyung Kim , Peter Zijlstra , Ravi Bangoria , Arnaldo Carvalho de Melo , x86 , LKML In-Reply-To: <20200228093616.67125-6-jolsa@kernel.org> References: <20200228093616.67125-6-jolsa@kernel.org> MIME-Version: 1.0 Message-ID: <158462705032.28353.2819488994049030835.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/core branch of tip: Commit-ID: d942815a76463fa53b81d3d1c064f76bb3f80ead Gitweb: https://git.kernel.org/tip/d942815a76463fa53b81d3d1c064f76bb3f80ead Author: Jiri Olsa AuthorDate: Fri, 28 Feb 2020 10:36:16 +01:00 Committer: Arnaldo Carvalho de Melo CommitterDate: Mon, 09 Mar 2020 21:43:25 -03:00 perf expr: Make expr__parse() return -1 on error To match the error value of the expr__find_other function, so all exported expr functions return the same values: 0 on success, -1 on error. Signed-off-by: Jiri Olsa Reviewed-by: Andi Kleen Cc: Alexander Shishkin Cc: John Garry Cc: Kajol Jain Cc: Michael Petlan Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Ravi Bangoria Link: http://lore.kernel.org/lkml/20200228093616.67125-6-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/expr.c | 4 ++-- tools/perf/util/expr.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/perf/tests/expr.c b/tools/perf/tests/expr.c index 755d73c..28313e5 100644 --- a/tools/perf/tests/expr.c +++ b/tools/perf/tests/expr.c @@ -45,11 +45,11 @@ int test__expr(struct test *t __maybe_unused, int subtest __maybe_unused) p = "FOO/0"; ret = expr__parse(&val, &ctx, p); - TEST_ASSERT_VAL("division by zero", ret == 1); + TEST_ASSERT_VAL("division by zero", ret == -1); p = "BAR/"; ret = expr__parse(&val, &ctx, p); - TEST_ASSERT_VAL("missing operand", ret == 1); + TEST_ASSERT_VAL("missing operand", ret == -1); TEST_ASSERT_VAL("find other", expr__find_other("FOO + BAR + BAZ + BOZO", "FOO", &other, &num_other) == 0); diff --git a/tools/perf/util/expr.c b/tools/perf/util/expr.c index 45b2553..fd192dd 100644 --- a/tools/perf/util/expr.c +++ b/tools/perf/util/expr.c @@ -54,7 +54,7 @@ __expr__parse(double *val, struct parse_ctx *ctx, const char *expr, int expr__parse(double *final_val, struct parse_ctx *ctx, const char *expr) { - return __expr__parse(final_val, ctx, expr, EXPR_PARSE); + return __expr__parse(final_val, ctx, expr, EXPR_PARSE) ? -1 : 0; } static bool