[PATCH] usb: renesas_usbhs: simplify list handling

From: Nicholas Mc Guire
Date: Mon Nov 07 2016 - 14:06:26 EST


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@xxxxxxxxx>
---
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