Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1235822imm; Tue, 5 Jun 2018 11:07:54 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKDYSF37+4PTT01fMlsEoko07+sEcvbli+I9yJpQBmJjc5F4Oe6+cD7AFZwYFiA88agu3ka X-Received: by 2002:a17:902:8f8b:: with SMTP id z11-v6mr27418993plo.203.1528222074443; Tue, 05 Jun 2018 11:07:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528222074; cv=none; d=google.com; s=arc-20160816; b=T95JFRa3rLr4Q8qjnVfw+9CpKl6PYhths/OtPOlVjaCYu3dZpznepZZN60vSOhUzi9 1Mw400QHSBCoaToDeYpHpnTzYYx190NCOIeu1vVS+jLFtQ/xK61x75LWUi4+4f1OSP1T eadGsYS88dhOSZYDb5IEzTtxpGYS4hBtVNzLYLtUsJ3VXLmtEYpxWSv9jEEAR5CpZ2SQ FaoVqRptCOO9MAbP+UbfXpcuRwg7n+0KnK1QA8vkc9II3eih9mMMabns1IfiJBgwYY8Q u1qb1Pe//ho5dx/LzjVfNsmwhv2wZOJote2nsJHZUwqbqy19J+J0sC22QcLC6g/gw4lr 3tXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=n9BWzzOh3dVcKqOHDAyBo3MGawwgNb2IRlBudIgrkIY=; b=grfkLgFhWTlc8gyNH7AvkS0hZqfwqT1eoOjTXYT4NAimsvD7kCRkKluOT2ItPXo6/I wG8H3R3NH3nh17pgLQg+YWhTYmZb/VjiYNWnWpkrRpl5YrFBCbFmxZ4o/J2hBy1zf3WU +S2KZV31hiiMuTzMBMfBYqs0jPRob/e7GNte174R3OIHxhhkHLjdOrdIegcKv4r2vJG8 ERa4P5QHZIfvnjYUjdFrU+0NSPXBncPu002AY2lKLGTAcqCLBXKFVXJBzKJdRCoRkg7q L4+LbuaewTD83oDSA6LY45mWwyeo3RvqPiAmrc7zHXUjjviqBL57w2js2xKENCGJQvhs JMFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RwZIEhti; 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=pass (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 f10-v6si20602131pgs.655.2018.06.05.11.07.39; Tue, 05 Jun 2018 11:07:54 -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; dkim=pass header.i=@kernel.org header.s=default header.b=RwZIEhti; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752050AbeFERu4 (ORCPT + 99 others); Tue, 5 Jun 2018 13:50:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:45432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751852AbeFERuy (ORCPT ); Tue, 5 Jun 2018 13:50:54 -0400 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5A9272077B; Tue, 5 Jun 2018 17:50:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1528221054; bh=GydCMeCyhwFAKFIh55hX2SuYlsaEF7+lMiqPWreApLw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RwZIEhtiJNr/a3fZfVBmRgRRg3NmUbnkQHfU4Kj3Jk9D6s8s2qo6gebY60KJNZVBN vDQ8g/ZhQh4FiCDPgYJTgDUk32Nm7BnlGGMpjtVC1mjzLNYTJiDkgEkGBvXk0W4Obv EE5qK27iN/kXmgrjUMRlowiML0gkmYsSfikZeAuY= From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo , Adrian Hunter , David Ahern , Jiri Olsa , Krister Johansen , Namhyung Kim , Wang Nan Subject: [PATCH 04/46] perf tools: No need to check if the argument to __get() function is NULL Date: Tue, 5 Jun 2018 14:49:48 -0300 Message-Id: <20180605175030.32549-5-acme@kernel.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180605175030.32549-1-acme@kernel.org> References: <20180605175030.32549-1-acme@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnaldo Carvalho de Melo Those functions always check if the argument is NULL before trying to grab a reference count, and also will return the received object, so, to make code more compact, no need to check for NULL. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Krister Johansen Cc: Namhyung Kim Cc: Wang Nan Link: https://lkml.kernel.org/n/tip-i9wycjdxh0fwhryu55lmafks@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-probe.c | 3 +-- tools/perf/util/hist.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index c0065923a525..99de91698de1 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c @@ -81,8 +81,7 @@ static int parse_probe_event(const char *str) params.target_used = true; } - if (params.nsi) - pev->nsi = nsinfo__get(params.nsi); + pev->nsi = nsinfo__get(params.nsi); /* Parse a perf-probe command into event */ ret = parse_perf_probe_command(str, pev); diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 4d602fba40b2..95333b068109 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -1039,7 +1039,7 @@ int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al, int err, err2; struct map *alm = NULL; - if (al && al->map) + if (al) alm = map__get(al->map); err = sample__resolve_callchain(iter->sample, &callchain_cursor, &iter->parent, -- 2.14.3