From patchwork Mon Oct 31 10:49:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 80152 Delivered-To: patch@linaro.org Received: by 10.80.142.83 with SMTP id 19csp65990edx; Mon, 31 Oct 2016 03:52:12 -0700 (PDT) X-Received: by 10.98.20.131 with SMTP id 125mr9363008pfu.51.1477911132185; Mon, 31 Oct 2016 03:52:12 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c22si8064156pfk.219.2016.10.31.03.52.11; Mon, 31 Oct 2016 03:52:12 -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; 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 S936234AbcJaKwJ (ORCPT + 4 others); Mon, 31 Oct 2016 06:52:09 -0400 Received: from mga04.intel.com ([192.55.52.120]:41233 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936238AbcJaKwI (ORCPT ); Mon, 31 Oct 2016 06:52:08 -0400 Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP; 31 Oct 2016 03:52:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,426,1473145200"; d="scan'208";a="25692422" Received: from pipin.fi.intel.com (HELO localhost) ([10.237.68.37]) by orsmga005.jf.intel.com with ESMTP; 31 Oct 2016 03:52:06 -0700 From: Felipe Balbi To: Linux USB Cc: Masahiro Yamada , Felipe Balbi Subject: [PATCH 68/82] usb: dwc2: cleanup with list_first_entry_or_null() Date: Mon, 31 Oct 2016 12:49:00 +0200 Message-Id: <20161031104914.1990-69-felipe.balbi@linux.intel.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161031104914.1990-1-felipe.balbi@linux.intel.com> References: <20161031104914.1990-1-felipe.balbi@linux.intel.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Masahiro Yamada 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 Signed-off-by: Felipe Balbi --- drivers/usb/dwc2/gadget.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 2.10.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 24fbebc9b409..9dc6c482b89e 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -1099,10 +1099,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); } /**