From patchwork Sun Sep 18 16:03:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 76481 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp577113qgf; Sun, 18 Sep 2016 09:04:28 -0700 (PDT) X-Received: by 10.98.158.90 with SMTP id s87mr39716194pfd.117.1474214668920; Sun, 18 Sep 2016 09:04:28 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m2si23538776paf.87.2016.09.18.09.04.28; Sun, 18 Sep 2016 09:04:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755580AbcIRQEH (ORCPT + 4 others); Sun, 18 Sep 2016 12:04:07 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:36553 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752677AbcIRQEG (ORCPT ); Sun, 18 Sep 2016 12:04:06 -0400 Received: from grover.sesame (FL1-111-169-71-157.osk.mesh.ad.jp [111.169.71.157]) (authenticated) by conuserg-10.nifty.com with ESMTP id u8IG3LfX028491; Mon, 19 Sep 2016 01:03:26 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com u8IG3LfX028491 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1474214607; bh=nnLYV0ombgF0pgYl832XW0x2GGkPmHmztGErzWnnVkg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ejpkFfN0ry0j3h6m683GEhehBx556fThgudd+Z2ALQXyWyGYYYJBK7N4954n3cujs XmndUsxiClUgg3v/bCJk5SoYOhSy3vZOindiKIyntqqh/HVkSqpIIw4ZiPPB4j9FG1 hJTkMVKnX1jxBlI/I+1B06wt+8e1JRFjYIoIClFAb9AUDCFJJhJzfCWnVvDHVhRikB 8wNzWHMxKKv+fS5K+G61V+qdqHzOSCm2YmtQLj/G9k7lNcWvDTtMMfMFk9TNwX49bF EEuZPoK9ijzhxJahqUmGzyybMNt7nVNl4YHmhQClMrzhstKnAS1R/Oo+zuHVjsrMfb EwWL34BPvKaZg== X-Nifty-SrcIP: [111.169.71.157] From: Masahiro Yamada To: linux-usb@vger.kernel.org Cc: Felipe Balbi , Masahiro Yamada , Greg Kroah-Hartman , John Youn , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] usb: dwc2: cleanup with list_first_entry_or_null() Date: Mon, 19 Sep 2016 01:03:13 +0900 Message-Id: <1474214595-9349-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1474214595-9349-1-git-send-email-yamada.masahiro@socionext.com> References: <1474214595-9349-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Acked-by: John Youn --- drivers/usb/dwc2/gadget.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index af46adf..28a250a 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -1098,10 +1098,8 @@ static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value, bool now); */ 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); } /**