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


Groups > linux.kernel > #1485850

[PATCH v2 3/3] usb: renesas_usbhs: cleanup with list_first_entry_or_null()

Path csiph.com!news.mixmin.net!news.unit0.net!news.panservice.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod
From Masahiro Yamada <yamada.masahiro@socionext.com>
Newsgroups linux.kernel
Subject [PATCH v2 3/3] usb: renesas_usbhs: cleanup with list_first_entry_or_null()
Date Sun, 18 Sep 2016 18:10:01 +0200
Message-ID <siMPf-1Ng-7@gated-at.bofh.it> (permalink)
References <siMPf-1Ng-3@gated-at.bofh.it>
Dkim-Filter OpenDKIM Filter v2.10.3 conuserg-10.nifty.com u8IG3LfZ028491
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1474214609; bh=tzy+XzgwQZUWdXJm03BiMJI2Le/4dpodHuI/6CGkJTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1jS4uCxaOR7JP76C17lRheOw99rnSqojifVG+jBDYME5V6sJn0EU3iqiL7d+7BCSy i0hrcp0+LaweIFqmSeoaB2lWbJ/tss1u1whtc1ieWjzpVQ64LCW1epz0f3kDAnk566 nDeXOpNCfo4+kF7Uorl/AYycYos+Em5MqNfLfwnPaV28cGRjFBGjlpI+ZLt/jwc1HY 8g9zrvGB3kyC3L237hZH+6gQP6OUPkKNsIrGDa8iVP/ipFGzdhitAqIo47wzMWckqb O0nItlLCjCRwqCCy9ouvYSWwukc92M1HQG1BVJQJOfQ/BCG90UVQm9v7JsCKkarRdD j8E3p/9E8oVGQ==
X-Nifty-Srcip [111.169.71.157]
X-Mailer git-send-email 1.9.1
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 27
Organization linux.* mail to news gateway
X-Original-Cc Felipe Balbi <balbi@kernel.org>, Masahiro Yamada <yamada.masahiro@socionext.com>, Felipe Balbi <felipe.balbi@linux.intel.com>, linux-kernel@vger.kernel.org, Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>, Julia Lawall <Julia.Lawall@lip6.fr>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>
X-Original-Date Mon, 19 Sep 2016 01:03:15 +0900
X-Original-Message-ID <1474214595-9349-4-git-send-email-yamada.masahiro@socionext.com>
X-Original-References <1474214595-9349-1-git-send-email-yamada.masahiro@socionext.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1485850

Show key headers only | View raw


The combo of list_empty() check and return list_first_entry()
can be replaced with list_first_entry_or_null().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 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.9.1

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


Thread

[PATCH v2 0/3] usb: trivial cleanups with list_first_entry_or_null() Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-09-18 18:10 +0200
  [PATCH v2 3/3] usb: renesas_usbhs: cleanup with list_first_entry_or_null() Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-09-18 18:10 +0200
  [PATCH v2 1/3] usb: dwc2: cleanup with list_first_entry_or_null() Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-09-18 18:10 +0200

csiph-web