From patchwork Sun Sep 18 16:03:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 76482 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp577247qgf; Sun, 18 Sep 2016 09:04:51 -0700 (PDT) X-Received: by 10.67.23.4 with SMTP id hw4mr39909291pad.7.1474214691660; Sun, 18 Sep 2016 09:04:51 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c83si26992547pfl.298.2016.09.18.09.04.51; Sun, 18 Sep 2016 09:04:51 -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 S932528AbcIRQEs (ORCPT + 4 others); Sun, 18 Sep 2016 12:04:48 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:37571 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932140AbcIRQEq (ORCPT ); Sun, 18 Sep 2016 12:04:46 -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 u8IG3LfZ028491; Mon, 19 Sep 2016 01:03:28 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com u8IG3LfZ028491 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1474214609; bh=tzy+XzgwQZUWdXJm03BiMJI2Le/4dpodHuI/6CGkJTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1jS4uCxaOR7JP76C17lRheOw99rnSqojifVG+jBDYME5V6sJn0EU3iqiL7d+7BCSy i0hrcp0+LaweIFqmSeoaB2lWbJ/tss1u1whtc1ieWjzpVQ64LCW1epz0f3kDAnk566 nDeXOpNCfo4+kF7Uorl/AYycYos+Em5MqNfLfwnPaV28cGRjFBGjlpI+ZLt/jwc1HY 8g9zrvGB3kyC3L237hZH+6gQP6OUPkKNsIrGDa8iVP/ipFGzdhitAqIo47wzMWckqb O0nItlLCjCRwqCCy9ouvYSWwukc92M1HQG1BVJQJOfQ/BCG90UVQm9v7JsCKkarRdD j8E3p/9E8oVGQ== X-Nifty-SrcIP: [111.169.71.157] From: Masahiro Yamada To: linux-usb@vger.kernel.org Cc: Felipe Balbi , Masahiro Yamada , Felipe Balbi , linux-kernel@vger.kernel.org, Yoshihiro Shimoda , Julia Lawall , Greg Kroah-Hartman Subject: [PATCH v2 3/3] usb: renesas_usbhs: cleanup with list_first_entry_or_null() Date: Mon, 19 Sep 2016 01:03:15 +0900 Message-Id: <1474214595-9349-4-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/renesas_usbhs/fifo.c | 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/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index 857e783..d1af831 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c @@ -100,10 +100,7 @@ static void __usbhsf_pkt_del(struct usbhs_pkt *pkt) static struct usbhs_pkt *__usbhsf_pkt_get(struct usbhs_pipe *pipe) { - if (list_empty(&pipe->list)) - return NULL; - - return list_first_entry(&pipe->list, struct usbhs_pkt, node); + return list_first_entry_or_null(&pipe->list, struct usbhs_pkt, node); } static void usbhsf_fifo_clear(struct usbhs_pipe *pipe,