lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1473704975-4636-1-git-send-email-yamada.masahiro@socionext.com>
Date:   Tue, 13 Sep 2016 03:29:35 +0900
From:   Masahiro Yamada <yamada.masahiro@...ionext.com>
To:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        linux-kernel@...r.kernel.org
Cc:     Masahiro Yamada <yamada.masahiro@...ionext.com>,
        Andi Kleen <ak@...ux.intel.com>,
        Eric Engestrom <eric.engestrom@...tec.com>,
        He Kuang <hekuang@...wei.com>, Jiri Olsa <jolsa@...nel.org>
Subject: [PATCH] perf thread: cleanup with list_first_entry_or_null()

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 <yamada.masahiro@...ionext.com>
---

 tools/perf/util/thread.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

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)
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ