lkml.org 
[lkml]   [2016]   [Nov]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] usb: renesas_usbhs: simplify list handling
Date
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
\
 
 \ /
  Last update: 2016-11-07 20:06    [W:0.060 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site