From patchwork Mon Oct 31 10:49:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 80154 Delivered-To: patch@linaro.org Received: by 10.80.142.83 with SMTP id 19csp66005edx; Mon, 31 Oct 2016 03:52:15 -0700 (PDT) X-Received: by 10.99.219.21 with SMTP id e21mr14532748pgg.136.1477911134866; Mon, 31 Oct 2016 03:52:14 -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.14; Mon, 31 Oct 2016 03:52:14 -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 S936314AbcJaKwM (ORCPT + 4 others); Mon, 31 Oct 2016 06:52:12 -0400 Received: from mga07.intel.com ([134.134.136.100]:56068 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936249AbcJaKwK (ORCPT ); Mon, 31 Oct 2016 06:52:10 -0400 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP; 31 Oct 2016 03:52:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,426,1473145200"; d="scan'208";a="25692409" Received: from pipin.fi.intel.com (HELO localhost) ([10.237.68.37]) by fmsmga005.fm.intel.com with ESMTP; 31 Oct 2016 03:52:08 -0700 From: Felipe Balbi To: Linux USB Cc: Masahiro Yamada , Felipe Balbi Subject: [PATCH 69/82] usb: dwc3: cleanup with list_first_entry_or_null() Date: Mon, 31 Oct 2016 12:49:01 +0200 Message-Id: <20161031104914.1990-70-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 Signed-off-by: Felipe Balbi --- drivers/usb/dwc3/gadget.h | 5 +---- 1 file changed, 1 insertion(+), 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/dwc3/gadget.h b/drivers/usb/dwc3/gadget.h index e4a1d974a5ae..3129bcf74d7d 100644 --- a/drivers/usb/dwc3/gadget.h +++ b/drivers/usb/dwc3/gadget.h @@ -62,10 +62,7 @@ struct dwc3; static inline struct dwc3_request *next_request(struct list_head *list) { - if (list_empty(list)) - return NULL; - - return list_first_entry(list, struct dwc3_request, list); + return list_first_entry_or_null(list, struct dwc3_request, list); } static inline void dwc3_gadget_move_started_request(struct dwc3_request *req)