[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20220922123810.227015-1-chenzhongjin@huawei.com>
Date: Thu, 22 Sep 2022 20:38:10 +0800
From: Chen Zhongjin <chenzhongjin@...wei.com>
To: <linux-kernel@...r.kernel.org>, <kasan-dev@...glegroups.com>
CC: <dvyukov@...gle.com>, <andreyknvl@...il.com>,
<akpm@...ux-foundation.org>, <elver@...gle.com>,
<bigeasy@...utronix.de>, <nogikh@...gle.com>, <liu3101@...due.edu>,
<chenzhongjin@...wei.com>
Subject: [PATCH -next v2] kcov: Switch to use list_for_each_entry() helper
Use list_for_each_entry() helper instead of list_for_each() and
list_entry() to simplify code a bit.
Signed-off-by: Chen Zhongjin <chenzhongjin@...wei.com>
---
v1 -> v2:
- Forgot to change pos as area, fix it.
---
kernel/kcov.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/kernel/kcov.c b/kernel/kcov.c
index e19c84b02452..6c94913dc3a6 100644
--- a/kernel/kcov.c
+++ b/kernel/kcov.c
@@ -133,10 +133,8 @@ static struct kcov_remote *kcov_remote_add(struct kcov *kcov, u64 handle)
static struct kcov_remote_area *kcov_remote_area_get(unsigned int size)
{
struct kcov_remote_area *area;
- struct list_head *pos;
- list_for_each(pos, &kcov_remote_areas) {
- area = list_entry(pos, struct kcov_remote_area, list);
+ list_for_each_entry(area, &kcov_remote_areas, list) {
if (area->size == size) {
list_del(&area->list);
return area;
--
2.17.1
Powered by blists - more mailing lists