Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1518833ybg; Tue, 2 Jun 2020 12:11:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVWb6RPedOUfctdRQ0Sz5FMP8d2BywmGeKBiUVEYFDbcHi+okUn/Ksczwu+fz5kgIK6vuV X-Received: by 2002:a05:6402:1d0d:: with SMTP id dg13mr12576647edb.146.1591125064455; Tue, 02 Jun 2020 12:11:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591125064; cv=none; d=google.com; s=arc-20160816; b=MI64oiwQL6Xuty3MNIDvLrM8mg9a8mM9B/nKI5+4YkfGZB8HGRSlrpQriK/APTiEo1 HL3oRbZJzPMzRiKiZUZCQcr9qOPuzvF+XIe/GBURE+/Y6QehMZTAfX9zHV4IQVxo/Z+g +8/czpuncsw8/241Y7W0QZwSvhKI+hDu9Nsuu4kc6ARAwgpXbPMVAuomn6h/BnVWl1ED cu+FJHZfeR7HH7kfze17VoUWMD5xXhVcqOvh+ycM4P/7meqSNGtwYtApAincle5wBdyx CEen0gAfdwghGduk+sqKOwJy35NLqdEsCTYYQOAAkzrgvpI3R0DAIwWDWygVmzSt6ebS Cmug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=8y6oZjj3V4uWtlMv1o25l7nHDbVFUeee47F/Q2Ad1rQ=; b=lxFJSeL0QSr8FofIolao9SOIR/Lsq+Qn/l3eV1WNjWhnrq7+5FlIVU9hNXV2hf/ajW 5edZMToo7iydtg5qCDuMk3wSV7VXbGrvt50vwtSzqwZBw/BGrDBi1IidoraqAMfSoFlL +a6pIhc4FMS4MLNJgsZNrfLMXBvUjql9M4kJfk4IzYo04jtmJv8RTqQTQozR4PQRsMSO ur0q+1m0Y/2pBQvl1o5Gu6VuhV2JrKvhuYIeQszelzXgXm0yka+FjBaK9kdMFyAzM6Gk NglT1TxjEO0IX6lPZJc2NkNpTGUv6OPNWp+IpY7Md9uBAqSX+BLcsJHRJ2fRD8O9nxqN XZTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=H2MutNN6; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l9si2064012edn.352.2020.06.02.12.10.41; Tue, 02 Jun 2020 12:11:04 -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=@redhat.com header.s=mimecast20190719 header.b=H2MutNN6; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727860AbgFBTIZ (ORCPT + 99 others); Tue, 2 Jun 2020 15:08:25 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:40575 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726174AbgFBTIY (ORCPT ); Tue, 2 Jun 2020 15:08:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591124903; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8y6oZjj3V4uWtlMv1o25l7nHDbVFUeee47F/Q2Ad1rQ=; b=H2MutNN6Ktm0Jr1tptrKP7g+nL/GBpYug76ujVfE7JNtErQ1YjCzrXuPlxwFTh8Bztu+QT VLqdHnYlhTEALmJH8eMwIYOxZmiFW7Cj5Ryg2w8r8AyLEozQr9IV9sq9Iyi9FdjIL+D45v 3wZkp9n2htnyrUaG8Wi1eOt9t/YwvLg= 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-233-JEPnNF33M0OZSWHYSa9PIw-1; Tue, 02 Jun 2020 15:08:21 -0400 X-MC-Unique: JEPnNF33M0OZSWHYSa9PIw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5A7ED835B8C; Tue, 2 Jun 2020 19:08:19 +0000 (UTC) Received: from krava (unknown [10.40.192.62]) by smtp.corp.redhat.com (Postfix) with SMTP id 368312B4CC; Tue, 2 Jun 2020 19:08:16 +0000 (UTC) Date: Tue, 2 Jun 2020 21:08:15 +0200 From: Jiri Olsa To: Ian Rogers Cc: Jiri Olsa , Arnaldo Carvalho de Melo , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Stephane Eranian , Andi Kleen Subject: Re: [PATCH 04/13] perf tests: Add another metric parsing test Message-ID: <20200602190815.GH1169993@krava> References: <20200602115055.1168446-1-jolsa@kernel.org> <20200602115055.1168446-5-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 02, 2020 at 10:58:32AM -0700, Ian Rogers wrote: SNIP > > +static int check_parse_fake(const char *id) > > +{ > > + struct parse_events_error error; > > nit: this reads funny as it isn't clear, without looking at > check_parse_id, that error is zero initialized. right, how about something like below? thanks, jirka --- diff --git a/tools/perf/tests/pmu-events.c b/tools/perf/tests/pmu-events.c index d3343827eb4d..c745b6e13cbe 100644 --- a/tools/perf/tests/pmu-events.c +++ b/tools/perf/tests/pmu-events.c @@ -403,7 +403,6 @@ static int check_parse_id(const char *id, struct parse_events_error *error, evlist = evlist__new(); if (!evlist) return -ENOMEM; - memset(error, 0, sizeof(*error)); ret = parse_events(evlist, id, error, fake_pmu); evlist__delete(evlist); return ret; @@ -411,7 +410,7 @@ static int check_parse_id(const char *id, struct parse_events_error *error, static int check_parse_cpu(const char *id, bool same_cpu, struct pmu_event *pe) { - struct parse_events_error error; + struct parse_events_error error = { 0 }; int ret = check_parse_id(id, &error, false); if (ret && same_cpu) { @@ -433,7 +432,7 @@ static int check_parse_cpu(const char *id, bool same_cpu, struct pmu_event *pe) static int check_parse_fake(const char *id) { - struct parse_events_error error; + struct parse_events_error error = { 0 }; int ret = check_parse_id(id, &error, true); free(error.str);