From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756039AbdETRG4 (ORCPT ); Sat, 20 May 2017 13:06:56 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:39965 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751813AbdETRGy (ORCPT ); Sat, 20 May 2017 13:06:54 -0400 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v4KH6HsI002440 X-Nifty-SrcIP: [111.169.71.157] From: Masahiro Yamada To: linux-usb@vger.kernel.org Cc: Masahiro Yamada , Greg Kroah-Hartman , Chunfeng Yun , linux-kernel@vger.kernel.org Subject: [PATCH] usb: mtu3: cleanup with list_first_entry_or_null() Date: Sun, 21 May 2017 02:05:31 +0900 Message-Id: <1495299931-10418-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The combo of list_empty() and list_first_entry() can be replaced with list_first_entry_or_null(). Signed-off-by: Masahiro Yamada --- drivers/usb/mtu3/mtu3.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/usb/mtu3/mtu3.h b/drivers/usb/mtu3/mtu3.h index aa6fd6a..7b6dc23 100644 --- a/drivers/usb/mtu3/mtu3.h +++ b/drivers/usb/mtu3/mtu3.h @@ -356,12 +356,8 @@ static inline struct mtu3_ep *to_mtu3_ep(struct usb_ep *ep) static inline struct mtu3_request *next_request(struct mtu3_ep *mep) { - struct list_head *queue = &mep->req_list; - - if (list_empty(queue)) - return NULL; - - return list_first_entry(queue, struct mtu3_request, list); + return list_first_entry_or_null(&mep->req_list, struct mtu3_request, + list); } static inline void mtu3_writel(void __iomem *base, u32 offset, u32 data) -- 2.7.4