Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp547311ybt; Wed, 24 Jun 2020 05:44:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9QVGy1SrSv5U99HKkiWNbw3TAc6kG3EPechb6xJG/fCZ1R1lvHQl1wy/2TvRo/D9ukodR X-Received: by 2002:a05:6402:1803:: with SMTP id g3mr6361505edy.377.1593002656192; Wed, 24 Jun 2020 05:44:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593002656; cv=none; d=google.com; s=arc-20160816; b=yQX/ONREhvsUTsCoe5B8itS0jgyCOX+qc1RjK98ksazxdhcg5EUg6gP5prJ2w5H7Zc aECyHk/BygPw2Aojggmyf96iFwbQ0jSxa3aSl90zYkcQz+4nYwNITejtZg945PBfHgkg HlSBos7Ou3cOA/enrq2Fs+D4LIOpsxSge8pXxZ+YloqAklTxQPaFeGEyULWTdDLmixDH /9qsRzILQNU/xm2OeU0aH3trkA1J0q+82ad/mKADonZNplP795eQbh5Z0CDD5WHiTDq4 AqD+RkuKWwB9F+ZVa+qSfRfbsg8qDrI2AgDh7imA3cqN8xMF+ZJhDQvby3Tfwy5R75f7 Y7pg== 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=nejhpHIa27+I+N81kD1fZe2FhZEQndvCHobN1z/g+Sk=; b=lfzVbHtwR0OhW3XcawOiROwPZgl313Uy6KaBhHTN/9mmpNzn/D+I0suFhQGva4GGvu SQNaZuArJRibzROI8kCjFf7oaB/i8WkUFnznoXrcZcpGVblMM7sSsmpmED9N5r6znTe0 aCTK0RvafkLw5Wpj4k+mKbBXC4db/p+tRfo2Si37Eh+K11owyEhRjEvV4YYYLaQfK6gO H9mjL5Fs8IbsVD6QgUY71LbLLmOegJSGuWITkqkf+YDkc+SQt/6IRkngF28nwLib7cgx rT/lHkipGLaVIZYQT4BrWnWGs/PlUEHVA49fLQIzFw7PSvswhd4tLa0iXI6bL2pyerPJ RrgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=jTDqaZPg; 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 o11si12812383edv.414.2020.06.24.05.43.52; Wed, 24 Jun 2020 05:44:16 -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=jTDqaZPg; 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 S2390851AbgFXMmx (ORCPT + 99 others); Wed, 24 Jun 2020 08:42:53 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:55308 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389197AbgFXMmv (ORCPT ); Wed, 24 Jun 2020 08:42:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593002570; 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=nejhpHIa27+I+N81kD1fZe2FhZEQndvCHobN1z/g+Sk=; b=jTDqaZPgtuZo9S7aKvQSljjSuQLUPBTFMTcmYsmlt8cVy2w7jFcF7xN4oNESZMK8ry9aHv 4Cqa8AYFf11G8hwIlNbITzp/qWKLcb2P90AWhLVeQOZ/5jLz6gh3dJ/Q0ZV50cpsygzbQp 8Zjzv7aNNed9r3w/f4ctcnkp+u0F4Zg= 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-33-la3_z9xpNomDC5SmP5Z2bQ-1; Wed, 24 Jun 2020 08:42:46 -0400 X-MC-Unique: la3_z9xpNomDC5SmP5Z2bQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ABD4780400A; Wed, 24 Jun 2020 12:42:44 +0000 (UTC) Received: from krava (unknown [10.40.193.204]) by smtp.corp.redhat.com (Postfix) with SMTP id 496A951C50; Wed, 24 Jun 2020 12:42:42 +0000 (UTC) Date: Wed, 24 Jun 2020 14:42:41 +0200 From: Jiri Olsa To: Gaurav Singh Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Namhyung Kim , Adrian Hunter , Mathieu Poirier , Ian Rogers , "open list:PERFORMANCE EVENTS SUBSYSTEM" Subject: Re: [PATCH] [perf] intel_pt_recording_options: Remove redundant intel_pt_evsel null check Message-ID: <20200624124241.GA2719003@krava> References: <20200623234905.18608-1-gaurav1086@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200623234905.18608-1-gaurav1086@gmail.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 23, 2020 at 07:48:50PM -0400, Gaurav Singh wrote: > intel_pt_evsel cannot be NULL here since its already being > dereferenced above. Remove this redundant check. > > Signed-off-by: Gaurav Singh > --- > tools/perf/arch/x86/util/intel-pt.c | 24 +++++++++++------------- > 1 file changed, 11 insertions(+), 13 deletions(-) > > diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c > index 839ef52c1ac2..8cc87fd2dc6f 100644 > --- a/tools/perf/arch/x86/util/intel-pt.c > +++ b/tools/perf/arch/x86/util/intel-pt.c > @@ -836,19 +836,17 @@ static int intel_pt_recording_options(struct auxtrace_record *itr, > } > } > I wonder we sould put check before that above usage of intel_pt_evsel, because there's no check for that.. but yes, if intel_pt_evsel is NULL it will fail earlier.. Adrian? thanks, jirka > - if (intel_pt_evsel) { > - /* > - * To obtain the auxtrace buffer file descriptor, the auxtrace > - * event must come first. > - */ > - perf_evlist__to_front(evlist, intel_pt_evsel); > - /* > - * In the case of per-cpu mmaps, we need the CPU on the > - * AUX event. > - */ > - if (!perf_cpu_map__empty(cpus)) > - evsel__set_sample_bit(intel_pt_evsel, CPU); > - } > + /* > + * To obtain the auxtrace buffer file descriptor, the auxtrace > + * event must come first. > + */ > + perf_evlist__to_front(evlist, intel_pt_evsel); > + /* > + * In the case of per-cpu mmaps, we need the CPU on the > + * AUX event. > + */ > + if (!perf_cpu_map__empty(cpus)) > + evsel__set_sample_bit(intel_pt_evsel, CPU); > > /* Add dummy event to keep tracking */ > if (opts->full_auxtrace) { > -- > 2.17.1 >