From patchwork Fri Jul 15 13:35:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9232085 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 8DF4560574 for ; Fri, 15 Jul 2016 13:36:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E71F27F8F for ; Fri, 15 Jul 2016 13:36:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 728DF2832B; Fri, 15 Jul 2016 13:36:16 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 333FA27F8F for ; Fri, 15 Jul 2016 13:36:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 019606EA1C; Fri, 15 Jul 2016 13:36:10 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.web.de (mout.web.de [212.227.15.3]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3BE8F6EA1C for ; Fri, 15 Jul 2016 13:36:07 +0000 (UTC) Received: from [192.168.1.2] ([77.182.179.66]) by smtp.web.de (mrweb002) with ESMTPSA (Nemesis) id 0LfzcB-1b0WxL40r5-00pZDS; Fri, 15 Jul 2016 15:35:49 +0200 Subject: [PATCH] drm/rockchip: Delete an unnecessary check before drm_gem_object_unreference_unlocked() To: David Airlie , Heiko Stuebner , Mark Yao , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> From: SF Markus Elfring Message-ID: Date: Fri, 15 Jul 2016 15:35:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 In-Reply-To: <5317A59D.4@users.sourceforge.net> X-Provags-ID: V03:K0:MVDr+mZE7JfkRxuae0zuWxBJ9RH220D2H3R7TOW8imFo3JZEQol 1nn1t2NKmZ0VTZSnSyg3Z9byk0ZstyiSFlA8LUMGjr1mxT7gE4h0abUc7eFd61Bimp2iizH AWFXxs+epU2XZQRl5bQRFWuz+ofkRDFb6Fov/YA8ArDe5g4MTD6FE9ag7EofpodKS9mwUEa zAqRGJoep8/gBbGfupIOQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:iNlkJVe4yf4=:jgFAPnB9R03uDu10OGCqOJ aG19HNrMfD37Nx7Lo1pHH4cUiRvRfMcAm9yIkS6kgvB6ugJzzC9Eye7YSaxPd5CTnJH9WaamU O1BO3xS0ex1yJGYe+6ytPFq6y9iA8I4NhO4x2fbw97t11VweLzQU3sTe2EBU2wcWvnT/Rw3e+ C7Y6xR6eL5LLqaiVFhwm/0QNIPQZ/k6tj98lu/18EsQnXkBlk4hGaeqjmMp4yebTaVs+/f+Ns qzinb0NiooP2pK24HgNbu3kHgRQzVu2cnhRSU5uypT0tDX5iXGVkwKj5l+rRvx8L53ORvwfnk AUP/hCX5mDWZDm873RpqMzpW+Pdcsy89KHG5X2T8IN1Wv2ileI832WlAfTCkGHlkaUNN/nBQh 72S7dAMN2Z7+ELSXc5ZX4ym3cqtc4R3eLHMDXl/y0rk6VKA79yY0iTes+Z488eGKiczUCuqNQ ONKgd9+iQvCI5j3YAJK+9ZM+D/fS7nH2H7ySfbVylODjXNcoRpCE4fmBva+M/w547Covk3CTT g35QzqQww4ifxUgbxFykx6Lp+8h5G3q9PI5MrM3LgxYZ/9JWzvR8g3j6ycAhDuLDIeqDUzUnX 9+2VAbFfPCjpKxG8NmZFjyamWwbMQGb4+ia4TJmP0QLqXG0agUEEHu4DFhmcKwh/ts7OsJTzs GzacqrpMjNnRBIR+MiFw00eEtIDh/hbBvcp/8S7UrOaeZwlYlLU2DYRY5q+RO3iHs+WlyH52V VGMzMd3LkBm7E2SdIDi4exo7rtxCzNpr5odHYBBOO/GkmwSQSJnRjElBdVsL01UykcaSP985f hZ6Gazk Cc: Julia Lawall , kernel-janitors@vger.kernel.org, LKML 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Fri, 15 Jul 2016 15:23:22 +0200 The drm_gem_object_unreference_unlocked() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c index 20f12bc..6f64e79 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c @@ -43,14 +43,10 @@ struct drm_gem_object *rockchip_fb_get_gem_obj(struct drm_framebuffer *fb, static void rockchip_drm_fb_destroy(struct drm_framebuffer *fb) { struct rockchip_drm_fb *rockchip_fb = to_rockchip_fb(fb); - struct drm_gem_object *obj; int i; - for (i = 0; i < ROCKCHIP_MAX_FB_BUFFER; i++) { - obj = rockchip_fb->obj[i]; - if (obj) - drm_gem_object_unreference_unlocked(obj); - } + for (i = 0; i < ROCKCHIP_MAX_FB_BUFFER; i++) + drm_gem_object_unreference_unlocked(rockchip_fb->obj[i]); drm_framebuffer_cleanup(fb); kfree(rockchip_fb);