From patchwork Mon Sep 12 18:35:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 9328251 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 95A6460839 for ; Tue, 13 Sep 2016 00:32:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 899E528F10 for ; Tue, 13 Sep 2016 00:32:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E63F28F14; Tue, 13 Sep 2016 00:32:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B0A3E28F10 for ; Tue, 13 Sep 2016 00:32:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 09F626E5F4; Tue, 13 Sep 2016 00:32:17 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from conuserg-11.nifty.com (conuserg-11.nifty.com [210.131.2.78]) by gabe.freedesktop.org (Postfix) with ESMTPS id A1C836E274 for ; Mon, 12 Sep 2016 18:35:57 +0000 (UTC) Received: from grover.sesame (FL1-111-169-71-157.osk.mesh.ad.jp [111.169.71.157]) (authenticated) by conuserg-11.nifty.com with ESMTP id u8CIZMRd029415; Tue, 13 Sep 2016 03:35:25 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com u8CIZMRd029415 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1473705325; bh=NrbZFD/Y2ZdV4NYU68itQzXLJ1ajF0EduvT0TRSuhZQ=; h=From:To:Cc:Subject:Date:From; b=FldezNNUJVCQaMrlaiHpjFqwFLdRedSki1E6FPmp1ZI769YbTvcw0/PNizNiqAIRy vp9TvIEnksy5cZxi2iWAP5WRASDYKmAzGzMSz15E0hggwHZtTIn8X4B38PRddbcS+i QOxJwGgJ3lR63j7GUBYatvuGGfE2V30XkHaVfreuqJ5C9ZrqNwmwPWKTJ9U82H4oc+ H7Kx10vkm5JKzT6HqunvJQJrR/tj+icKvZMOyDqK4PWxYULt4tcDCcDW/KfkA3Io/x TFm5+OYzXRWqGlj3WYjBQZouthTCx4ToUmUrbeLj4VgkHV1AHLNr+1PLFRNXorzHs4 nPY7DKAZ9f9Vw== X-Nifty-SrcIP: [111.169.71.157] From: Masahiro Yamada To: Eric Anholt , David Airlie , dri-devel@lists.freedesktop.org (open list:DRM DRIVERS) Subject: [PATCH] drm/vc4: cleanup with list_first_entry_or_null() Date: Tue, 13 Sep 2016 03:35:20 +0900 Message-Id: <1473705320-6046-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 X-Mailman-Approved-At: Tue, 13 Sep 2016 00:32:01 +0000 Cc: Masahiro Yamada , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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/gpu/drm/vc4/vc4_drv.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index 428e249..61c1902 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -307,18 +307,15 @@ struct vc4_exec_info { static inline struct vc4_exec_info * vc4_first_bin_job(struct vc4_dev *vc4) { - if (list_empty(&vc4->bin_job_list)) - return NULL; - return list_first_entry(&vc4->bin_job_list, struct vc4_exec_info, head); + return list_first_entry_or_null(&vc4->bin_job_list, + struct vc4_exec_info, head); } static inline struct vc4_exec_info * vc4_first_render_job(struct vc4_dev *vc4) { - if (list_empty(&vc4->render_job_list)) - return NULL; - return list_first_entry(&vc4->render_job_list, - struct vc4_exec_info, head); + return list_first_entry_or_null(&vc4->render_job_list, + struct vc4_exec_info, head); } static inline struct vc4_exec_info *