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: 9232095 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 3488160865 for ; Fri, 15 Jul 2016 13:37:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2515827F8F for ; Fri, 15 Jul 2016 13:37:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19E352832C; Fri, 15 Jul 2016 13:37:55 +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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A349B27F8F for ; Fri, 15 Jul 2016 13:37:54 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bO3IE-0001OF-Lg; Fri, 15 Jul 2016 13:36:38 +0000 Received: from mout.web.de ([212.227.15.3]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bO3IC-0001Hk-80; Fri, 15 Jul 2016 13:36:37 +0000 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160715_063636_618860_A15710B2 X-CRM114-Status: GOOD ( 10.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Julia Lawall , kernel-janitors@vger.kernel.org, LKML Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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);