archive mirror
 help / color / mirror / Atom feed
From: Nicholas Mc Guire <>
To: John Youn <>
Cc: Greg Kroah-Hartman <>,,,
	Nicholas Mc Guire <>
Subject: [PATCH] usb: dwc2: gadget: simplify list handling
Date: Mon,  7 Nov 2016 20:08:03 +0100	[thread overview]
Message-ID: <> (raw)

The current code is effectively equivalent to list_first_entry_or_null()
so simply switch and simplify the code.

Fixes: 9c39ddc60ee9 ("USB: s3c-hsotg: Fix stall condition processing")
Signed-off-by: Nicholas Mc Guire <>
Found by simple coccinelle scanner

Compile tested with: x86_64_defconfig + CONFIG_USB_DWC2=m,

Patch is against 4.9.0-rc2 (localversion-next is next-20161028)

 drivers/usb/dwc2/gadget.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 24fbebc..9ac8ca0 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -1099,10 +1099,8 @@ static int dwc2_hsotg_process_req_status(struct dwc2_hsotg *hsotg,
 static struct dwc2_hsotg_req *get_ep_head(struct dwc2_hsotg_ep *hs_ep)
-	if (list_empty(&hs_ep->queue))
-		return NULL;
-	return list_first_entry(&hs_ep->queue, struct dwc2_hsotg_req, queue);
+	return list_first_entry_or_null(&hs_ep->queue,
+					struct dwc2_hsotg_req, queue);

             reply	other threads:[~2016-11-07 19:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-07 19:08 Nicholas Mc Guire [this message]
2016-11-07 19:16 ` John Youn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \
    --subject='Re: [PATCH] usb: dwc2: gadget: simplify list handling' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).