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>] [day] [month] [year] [list]
Date:   Sat,  3 Sep 2016 09:06:30 +0200
From:   Christophe JAILLET <christophe.jaillet@...adoo.fr>
To:     airlied@...ux.ie
Cc:     dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org,
        Christophe JAILLET <christophe.jaillet@...adoo.fr>
Subject: [PATCH] drm: flip-work: Simplify code

Calling 'list_splice_tail' followed by 'INIT_LIST_HEAD' is equivalent to
'list_splice_tail_init'.

This has been spotted with the following coccinelle script:
/////
@@
expression y,z;
@@

-   list_splice_tail(y,z);
-   INIT_LIST_HEAD(y);
+   list_splice_tail_init(y,z);

Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
---
 drivers/gpu/drm/drm_flip_work.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_flip_work.c b/drivers/gpu/drm/drm_flip_work.c
index 12dea16f22a8..c8b54a6694f6 100644
--- a/drivers/gpu/drm/drm_flip_work.c
+++ b/drivers/gpu/drm/drm_flip_work.c
@@ -101,8 +101,7 @@ void drm_flip_work_commit(struct drm_flip_work *work,
 	unsigned long flags;
 
 	spin_lock_irqsave(&work->lock, flags);
-	list_splice_tail(&work->queued, &work->commited);
-	INIT_LIST_HEAD(&work->queued);
+	list_splice_tail_init(&work->queued, &work->commited);
 	spin_unlock_irqrestore(&work->lock, flags);
 	queue_work(wq, &work->worker);
 }
@@ -119,8 +118,7 @@ static void flip_worker(struct work_struct *w)
 
 		INIT_LIST_HEAD(&tasks);
 		spin_lock_irqsave(&work->lock, flags);
-		list_splice_tail(&work->commited, &tasks);
-		INIT_LIST_HEAD(&work->commited);
+		list_splice_tail_init(&work->commited, &tasks);
 		spin_unlock_irqrestore(&work->lock, flags);
 
 		if (list_empty(&tasks))
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ