From: Pranith Kumar <bobby.prani@gmail.com>
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] llist: Use for conditional in llist_del_first()
Date: Wed, 28 Oct 2015 23:53:42 -0400 [thread overview]
Message-ID: <1446090823-19947-1-git-send-email-bobby.prani@gmail.com> (raw)
Simplify the code a bit by using the initializer and conditional
check in for() instead of a separate if() statement in the loop.
Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
lib/llist.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/lib/llist.c b/lib/llist.c
index 0b0e977..03d7aad 100644
--- a/lib/llist.c
+++ b/lib/llist.c
@@ -66,10 +66,7 @@ struct llist_node *llist_del_first(struct llist_head *head)
{
struct llist_node *entry, *old_entry, *next;
- entry = head->first;
- for (;;) {
- if (entry == NULL)
- return NULL;
+ for (entry = head->first; entry ;) {
old_entry = entry;
next = entry->next;
entry = cmpxchg(&head->first, old_entry, next);
--
2.6.2
reply other threads:[~2015-10-29 3:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1446090823-19947-1-git-send-email-bobby.prani@gmail.com \
--to=bobby.prani@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome