Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1485848

[PATCH v2 2/3] usb: dwc3: cleanup with list_first_entry_or_null()

Path csiph.com!news.mixmin.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Masahiro Yamada <yamada.masahiro@socionext.com>
Newsgroups linux.kernel
Subject [PATCH v2 2/3] usb: dwc3: cleanup with list_first_entry_or_null()
Date Sun, 18 Sep 2016 18:10:01 +0200
Message-ID <siMPf-1Ng-1@gated-at.bofh.it> (permalink)
References <siMPf-1Ng-3@gated-at.bofh.it>
X-Original-To linux-usb@vger.kernel.org
Dkim-Filter OpenDKIM Filter v2.10.3 conuserg-10.nifty.com u8IG3LfY028491
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1474214608; bh=/pip4zjxzHis778CAkwuqKGF5JVKSeeffPfYyo6w7rc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bbPzYD2+DFBkyJkUEA5KDONrZZ4ThTZuKujTR3TXjozcQ8osOcWbhRWnZKnCx76wn 3BpnH5+bdk9T7r40p0DWZk4XETrbuAovNaV7kc4FwSSLGSoJ4ydx2Q0vKc023HQdrv fVWu+FI4SOmhtGK+MWxrnf4LoKy9tPUkwdGH2zTH6GWsPwmEpb/0aJRVmHS/fDuUwO 0lpCkp6r98ZTfONJ69SnbSpDr0i42bzdMOA9fHN6ZRHfbcgwBT+nRjObTtQq4EyN8F eSf7MYujAp8x8LjXN+zTuzsHkMu0ab8X07+PDYHwyNMW44AtwtlfpDy8VoJwqWUu1g z435QtOy/AaNQ==
X-Nifty-Srcip [111.169.71.157]
X-Mailer git-send-email 1.9.1
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 27
Organization linux.* mail to news gateway
X-Original-Cc Felipe Balbi <balbi@kernel.org>, Masahiro Yamada <yamada.masahiro@socionext.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org
X-Original-Date Mon, 19 Sep 2016 01:03:14 +0900
X-Original-Message-ID <1474214595-9349-3-git-send-email-yamada.masahiro@socionext.com>
X-Original-References <1474214595-9349-1-git-send-email-yamada.masahiro@socionext.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1485848

Show key headers only | View raw


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@socionext.com>
---

 drivers/usb/dwc3/gadget.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.h b/drivers/usb/dwc3/gadget.h
index e4a1d97..3129bcf 100644
--- a/drivers/usb/dwc3/gadget.h
+++ b/drivers/usb/dwc3/gadget.h
@@ -62,10 +62,7 @@ struct dwc3;
 
 static inline struct dwc3_request *next_request(struct list_head *list)
 {
-	if (list_empty(list))
-		return NULL;
-
-	return list_first_entry(list, struct dwc3_request, list);
+	return list_first_entry_or_null(list, struct dwc3_request, list);
 }
 
 static inline void dwc3_gadget_move_started_request(struct dwc3_request *req)
-- 
1.9.1

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH v2 2/3] usb: dwc3: cleanup with list_first_entry_or_null() Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-09-18 18:10 +0200

csiph-web