lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1478545622-29591-1-git-send-email-hofrat@osadl.org>
Date:   Mon,  7 Nov 2016 20:07:02 +0100
From:   Nicholas Mc Guire <hofrat@...dl.org>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
        Felipe Balbi <felipe.balbi@...ux.intel.com>,
        Julia Lawall <Julia.Lawall@...6.fr>, linux-usb@...r.kernel.org,
        linux-kernel@...r.kernel.org, Nicholas Mc Guire <hofrat@...dl.org>
Subject: [PATCH] usb: renesas_usbhs: simplify list handling

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@...dl.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ