From patchwork Sun Sep 18 16:03:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 76480 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp576960qgf; Sun, 18 Sep 2016 09:04:08 -0700 (PDT) X-Received: by 10.98.6.68 with SMTP id 65mr39336093pfg.116.1474214648263; Sun, 18 Sep 2016 09:04:08 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t9si17055449pal.288.2016.09.18.09.04.08; Sun, 18 Sep 2016 09:04:08 -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 S1753127AbcIRQD4 (ORCPT + 4 others); Sun, 18 Sep 2016 12:03:56 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:36265 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752677AbcIRQDz (ORCPT ); Sun, 18 Sep 2016 12:03:55 -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 u8IG3LfY028491; Mon, 19 Sep 2016 01:03:27 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com u8IG3LfY028491 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1474214608; bh=/pip4zjxzHis778CAkwuqKGF5JVKSeeffPfYyo6w7rc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bbPzYD2+DFBkyJkUEA5KDONrZZ4ThTZuKujTR3TXjozcQ8osOcWbhRWnZKnCx76wn 3BpnH5+bdk9T7r40p0DWZk4XETrbuAovNaV7kc4FwSSLGSoJ4ydx2Q0vKc023HQdrv fVWu+FI4SOmhtGK+MWxrnf4LoKy9tPUkwdGH2zTH6GWsPwmEpb/0aJRVmHS/fDuUwO 0lpCkp6r98ZTfONJ69SnbSpDr0i42bzdMOA9fHN6ZRHfbcgwBT+nRjObTtQq4EyN8F eSf7MYujAp8x8LjXN+zTuzsHkMu0ab8X07+PDYHwyNMW44AtwtlfpDy8VoJwqWUu1g z435QtOy/AaNQ== X-Nifty-SrcIP: [111.169.71.157] From: Masahiro Yamada To: linux-usb@vger.kernel.org Cc: Felipe Balbi , Masahiro Yamada , Greg Kroah-Hartman , linux-kernel@vger.kernel.org Subject: [PATCH v2 2/3] usb: dwc3: cleanup with list_first_entry_or_null() Date: Mon, 19 Sep 2016 01:03:14 +0900 Message-Id: <1474214595-9349-3-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 --- drivers/usb/dwc3/gadget.h | 5 +---- 1 file changed, 1 insertion(+), 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/dwc3/gadget.h b/drivers/usb/dwc3/gadget.h index e4a1d97..3129bcf 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)