From patchwork Mon Sep 12 18:29:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 76022 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp985242qgf; Mon, 12 Sep 2016 11:31:03 -0700 (PDT) X-Received: by 10.67.7.228 with SMTP id df4mr35820316pad.24.1473705063627; Mon, 12 Sep 2016 11:31:03 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qi7si76844pac.183.2016.09.12.11.31.03; Mon, 12 Sep 2016 11:31:03 -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=@nifty.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 S1753462AbcILSbB (ORCPT + 27 others); Mon, 12 Sep 2016 14:31:01 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:36443 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751389AbcILSa7 (ORCPT ); Mon, 12 Sep 2016 14:30:59 -0400 Received: from grover.sesame (FL1-111-169-71-157.osk.mesh.ad.jp [111.169.71.157]) (authenticated) by conuserg-08.nifty.com with ESMTP id u8CITc7K024737; Tue, 13 Sep 2016 03:29:41 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com u8CITc7K024737 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1473704981; bh=I1MYDhAb87tE4UqdRGnUm7A49FlFJiCSVsuXmX+nNiY=; h=From:To:Cc:Subject:Date:From; b=l5shinGuCM+MH/y/xfeT8MqkaL6MTMtmrU4n7r5200lXvCBMZSmH77bObsZxFzbkZ D7oqLWxlUWV1T4zR1pir/iqvRhOZirF0XTngbm/uh4Y4UlqrJfaoQO0Nnc9awphG7E Erx+wPMRPBk2psyKYynaOPpORj44226/j5EKjUN4fZGsDLyN7HZntIjSdzXVADqt5y KtIJnHKnA4hNdtob7o76ljBJwpUAd8L7jxSwqtn4yt562zRbZxPxwdeb6aKCsznxr5 p//3CyYBHXhcM2DA9gtrgXqcCqzDs66WG15F8yGRmQbBIRprWPiXWKvXv3lD6oDy+K 7MSA8GPtu0k0w== X-Nifty-SrcIP: [111.169.71.157] From: Masahiro Yamada To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , linux-kernel@vger.kernel.org Cc: Masahiro Yamada , Andi Kleen , Eric Engestrom , He Kuang , Jiri Olsa Subject: [PATCH] perf thread: cleanup with list_first_entry_or_null() Date: Tue, 13 Sep 2016 03:29:35 +0900 Message-Id: <1473704975-4636-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The combo of list_empty() check and return list_first_entry() can be replaced with list_first_entry_or_null(). Signed-off-by: Masahiro Yamada --- tools/perf/util/thread.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) -- 1.9.1 diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index 8b10a55..ea951df 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c @@ -107,10 +107,7 @@ void thread__put(struct thread *thread) struct comm *thread__comm(const struct thread *thread) { - if (list_empty(&thread->comm_list)) - return NULL; - - return list_first_entry(&thread->comm_list, struct comm, list); + return list_first_entry_or_null(&thread->comm_list, struct comm, list); } struct comm *thread__exec_comm(const struct thread *thread)