From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756685AbbJ2DxG (ORCPT ); Wed, 28 Oct 2015 23:53:06 -0400 Received: from mail-yk0-f171.google.com ([209.85.160.171]:34712 "EHLO mail-yk0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756485AbbJ2DxE (ORCPT ); Wed, 28 Oct 2015 23:53:04 -0400 From: Pranith Kumar To: Rasmus Villemoes , Andrew Morton , 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 Message-Id: <1446090823-19947-1-git-send-email-bobby.prani@gmail.com> X-Mailer: git-send-email 2.6.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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