From patchwork Mon Nov 16 14:45:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 7628121 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AA05BBF90C for ; Mon, 16 Nov 2015 14:46:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E295D203ED for ; Mon, 16 Nov 2015 14:46:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A6BCB205BE for ; Mon, 16 Nov 2015 14:46:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 940AD6E0EF; Mon, 16 Nov 2015 06:46:05 -0800 (PST) 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.17.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id E32B96E0EF for ; Mon, 16 Nov 2015 06:46:03 -0800 (PST) Received: from [192.168.1.3] ([77.181.163.50]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0LqUPN-1abXgE1neb-00e36K; Mon, 16 Nov 2015 15:45:59 +0100 Subject: [PATCH] GPU-DRM-TTM: Delete an unnecessary check before the function call "ttm_tt_destroy" To: dri-devel@lists.freedesktop.org, David Airlie 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: <5649EC25.3040004@users.sourceforge.net> Date: Mon, 16 Nov 2015 15:45:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <5317A59D.4@users.sourceforge.net> X-Provags-ID: V03:K0:eJz68UMuuyG16MFO2sArA/ccHEvi49nI6l4/Z+xLR16u10SsBfA 6pg++p+jePSoh5t2rMOJMJxZKAjpcm5PuuybvZUOcS6dlfHlWCdO6iHouoUtIcOILRbPnmp 6zNAsp2u288rnPwnIpmF6q3XZ74qOAKNkTcV0Rg6/mrAcl1ZU0Gv0Vq8wSQxSGDP/lxx/q+ pZrrljsAuoj254eod8ifw== X-UI-Out-Filterresults: notjunk:1; V01:K0:+YufraUzGMQ=:47rDamk1l5e25GkgAfic/o BKRMbwOJKUDMYmiAFh+EzPreQtW5GY8ma4q8BoitIWwmeQTadwIRv7iInmFv6NFqEScUJyvVX N7NynxxZtpDoZ5XSUWvFItszLWhzwIKXYjfi5BxNWzAyBxhvZriJ5d3L5cvMv7iGjcoHdForT oBaeOWnzKdRCTTi6C18ZCZlAd9ffFEYT5/wuRH1dTEmP8Eq7Gs5bzpLTWYCmHgV6uhP8tvG5F RP0WMlbOe/WqIVGU9KZEORdAw8nj47idzkdJci4sXWqVHWHt0p7Hn15q2DbspngBqDuw86ew3 9ldEHQ6Pa5Fxtw9wFnJA2jR8z8z1jBvXczEay1qQvUyCHz/IRtX7GTN8bHoSl94FcisrclNPO jHHDtc9j356W2kzkgA/CfHa9NfwQUVG6Wi2+WN2NB25YIzAynCwn/H/ZpIV8jjOkBP/UqlXKn zJGH5Kfrd1bamlUvQWLIdwVxT586hiEq6aeTJVilXEXj5/MIzAOL0QZ3kTBrBoFPZttedK8YV nCAqvw/QHTpzyNe0J+2lwktHETM85LdJnBX0X/hbzdDl91HOP7KgcVorht/FsBAWlMG6HURI2 Wsjsoug6KmN1EaX6uNr9aAHw5VI183haQ2hkWfG3pXleqdHYPP4RQL6tntJKs1NI+gLtKqeGA PbjVwA0ZrTYdvKdqb2PnuCsPU2Ss2lHQ0ciknIjMLJYYuAzF7el1IUAYLK7YjDzHdhpswpHHO DYkpC9ugRMT/Oc+yZ4beBBAvyA8HaqeGQwua8gFkbY8atvp4AD83gzvVvxYopa5Ka+NzBiDuc +BtjSPu Cc: Julia Lawall , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Mon, 16 Nov 2015 15:40:58 +0100 The ttm_tt_destroy() 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/ttm/ttm_bo.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 745e996..d6736e6 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -147,8 +147,7 @@ static void ttm_bo_release_list(struct kref *list_kref) BUG_ON(!list_empty(&bo->lru)); BUG_ON(!list_empty(&bo->ddestroy)); - if (bo->ttm) - ttm_tt_destroy(bo->ttm); + ttm_tt_destroy(bo->ttm); atomic_dec(&bo->glob->bo_count); if (bo->resv == &bo->ttm_resv) reservation_object_fini(&bo->ttm_resv);