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


Groups > linux.kernel > #1516500

[PATCH] usb: renesas_usbhs: simplify list handling

From Nicholas Mc Guire <hofrat@osadl.org>
Newsgroups linux.kernel
Subject [PATCH] usb: renesas_usbhs: simplify list handling
Date 2016-11-07 20:10 +0100
Message-ID <sAXsS-7ns-25@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] usb: renesas_usbhs: simplify list handling Nicholas Mc Guire <hofrat@osadl.org> - 2016-11-07 20:10 +0100
  RE: [PATCH] usb: renesas_usbhs: simplify list handling Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> - 2016-11-08 03:20 +0100
    Re: [PATCH] usb: renesas_usbhs: simplify list handling Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-11-08 04:30 +0100
      Re: [PATCH] usb: renesas_usbhs: simplify list handling Nicholas Mc Guire <der.herr@hofr.at> - 2016-11-08 08:20 +0100

csiph-web