Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2181985ybv; Mon, 24 Feb 2020 00:31:19 -0800 (PST) X-Google-Smtp-Source: APXvYqwPR+LiQNgZpGMb5T19H0+MX44rtSWCNl6foI6c3S8WXWLPR5JJlr+c+kyVmR56xEn9bV8Z X-Received: by 2002:aca:49ce:: with SMTP id w197mr11937730oia.16.1582533079749; Mon, 24 Feb 2020 00:31:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582533079; cv=none; d=google.com; s=arc-20160816; b=GMfI93GcDfvsDVuDVaeMMBNMyc1zk5IOBiqbA+KjwwwIZ4fsBmUfjZ1XzR/53Ng0V5 r42XLVOAj7KxRVDUTJSZ5MlOKIh8FwjB4XB8HlidlPv/+l3+TfwIZ0mhmSV/sTInirr4 9OGlgz1U3LQU82v5W9aE3C8gjeJS/LkZU3IbyktDoU/ufBKYQm/XA23bPt8B8wYyVnHw Y5dqOwkWa4r0TKwiDTRxmFhdFTNASiWgTrkOz8B38KV7V/lew9z4k72tknCrardjET0f MWVoOX/TdT9K5UR7BhmJQtTGgCH2Vmc4VkgXb8WBHmYZaFdfC4JrtJ5JQRdSCqmcxQdS zrHQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=BCptEaS0Ov9O+XedxKjIMzFEZdpS9K8zEc74G440D4Q=; b=FqZGtDUrBVD+7Pt8ZFWzGBNpJ2dByZKmi8ixBOotKNQ3Wd+L0ePSme5+9cRs9/MPBq aQuF2bPif6U+khjpEYoTkWjazN9p4TfEFpqlXpOzCgJAANvFLZi1S7mgL+yf1Bzf/g8S sBzDgRVLJfp03gkgLBNmMqCF5aceCPtJfg2aVfxdmTIqSH/6LmDZEdVmZ7QOKTT3qGoq lZPkpPDVRf2gTt1yZr0wFYOjV7CgPSbaSw4ERmkGja4AGjjidj8+x1D6OSMIs6DPRK/6 RYzbTVkWBh/jlzi8wuf+jR82MMmnm7sPtGED20ijS3xc+mqC8hCRxq8AqkkhNNRvWlq6 rR5Q== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l19si4359736oii.54.2020.02.24.00.30.59; Mon, 24 Feb 2020 00:31:19 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727382AbgBXI3q convert rfc822-to-8bit (ORCPT + 99 others); Mon, 24 Feb 2020 03:29:46 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:22015 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727197AbgBXI3q (ORCPT ); Mon, 24 Feb 2020 03:29:46 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-355-uh8hD3SlPJqix-NZqT98nA-1; Mon, 24 Feb 2020 03:29:43 -0500 X-MC-Unique: uh8hD3SlPJqix-NZqT98nA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5E7ED801E5C; Mon, 24 Feb 2020 08:29:41 +0000 (UTC) Received: from krava.redhat.com (ovpn-205-68.brq.redhat.com [10.40.205.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id D657E85781; Mon, 24 Feb 2020 08:29:38 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Ravi Bangoria , Andi Kleen , Kajol Jain , John Garry Subject: [PATCH 5/5] perf expr: Make expr__parse return -1 on error Date: Mon, 24 Feb 2020 09:29:18 +0100 Message-Id: <20200224082918.58489-6-jolsa@kernel.org> In-Reply-To: <20200224082918.58489-1-jolsa@kernel.org> References: <20200224082918.58489-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 755d73c86c68..28313e59d6f6 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 45b25530db5b..fd192ddf93c1 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 -- 2.24.1