linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: renesas_usbhs: simplify list handling
@ 2016-11-07 19:07 Nicholas Mc Guire
  2016-11-08  2:17 ` Yoshihiro Shimoda
  0 siblings, 1 reply; 4+ messages in thread
From: Nicholas Mc Guire @ 2016-11-07 19:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Yoshihiro Shimoda, Felipe Balbi, Julia Lawall, linux-usb,
	linux-kernel, Nicholas Mc Guire

The current code is effectively equivalent to list_first_entry_or_null()
so simply switch and simplify the code.

Fixes: 6acb95d4e070 ("usb: renesas_usbhs: modify packet queue control method")
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---
Found by simple coccinelle scanner

Compile tested with: multi_v7_defconfig (implies 
CONFIG_USB_RENESAS_USBHS=m)

Patch is against 4.9.0-rc2 (localversion-next is next-20161028)

 drivers/usb/renesas_usbhs/fifo.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
index 857e783..d1af831 100644
--- a/drivers/usb/renesas_usbhs/fifo.c
+++ b/drivers/usb/renesas_usbhs/fifo.c
@@ -100,10 +100,7 @@ static void __usbhsf_pkt_del(struct usbhs_pkt *pkt)
 
 static struct usbhs_pkt *__usbhsf_pkt_get(struct usbhs_pipe *pipe)
 {
-	if (list_empty(&pipe->list))
-		return NULL;
-
-	return list_first_entry(&pipe->list, struct usbhs_pkt, node);
+	return list_first_entry_or_null(&pipe->list, struct usbhs_pkt, node);
 }
 
 static void usbhsf_fifo_clear(struct usbhs_pipe *pipe,
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-11-08  7:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-07 19:07 [PATCH] usb: renesas_usbhs: simplify list handling Nicholas Mc Guire
2016-11-08  2:17 ` Yoshihiro Shimoda
2016-11-08  3:26   ` Masahiro Yamada
2016-11-08  7:05     ` Nicholas Mc Guire

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).