From patchwork Mon Jul 18 14:10:36 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: 9234631 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 0DB796075D for ; Mon, 18 Jul 2016 14:10:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F354926C2F for ; Mon, 18 Jul 2016 14:10:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E81C926CF9; Mon, 18 Jul 2016 14:10:58 +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 7FEDF26C2F for ; Mon, 18 Jul 2016 14:10:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CE08A6E42B; Mon, 18 Jul 2016 14:10:56 +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.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id 626F56E430 for ; Mon, 18 Jul 2016 14:10:54 +0000 (UTC) Received: from [192.168.1.2] ([77.181.186.47]) by smtp.web.de (mrweb004) with ESMTPSA (Nemesis) id 0LxqwW-1bJQho1zT2-015MlW; Mon, 18 Jul 2016 16:10:48 +0200 Subject: [PATCH v3] drm/ttm: Delete an unnecessary check before the function call "ttm_tt_destroy" To: dri-devel@lists.freedesktop.org, Daniel Vetter , David Airlie References: <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> <5649EC25.3040004@users.sourceforge.net> <20160718071208.GV17101@phenom.ffwll.local> From: SF Markus Elfring Message-ID: <54338f58-830c-a8b4-4554-5d4459bcd321@users.sourceforge.net> Date: Mon, 18 Jul 2016 16:10:36 +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: <20160718071208.GV17101@phenom.ffwll.local> X-Provags-ID: V03:K0:7Hf5+g3rmbbAki+YdsWf5AagxM86KtHfOQkHiXGc7Sm+KvKYVqJ +K4zx2vpa+2+kjnoSOyBOthZLwWl1/GPVDkzUWYO6GgXs93iQno3KCLmnmLLr+KhrCfy+Ex Zaea8fkxAI7Jju9KM4gsjwaV8VP14n/AOVyTLY2hNx8fdo5jPB7VO9nKW46TA9JLtnCqbgH yePJH/Ossz/Q1jluuI/mA== X-UI-Out-Filterresults: notjunk:1; V01:K0:7J1QMxXhbD4=:J2KPPzXda/ijiwKcFrTo+I AFen42XigtCn0qdMGXcrNHuQy2LZ+5QZExMFeuOE0NQe5TcZ/4m6YSGNqxGasPfHCCi3GAMaM 5e+Ig4tn20c44OOs/MHcBh23IqlpEfFCE6w0N5Aa8FkmYeC20mS2e8HSdS4811HsSND9Z6G3c 6YU84gBPfxsbTEAEISUpmp61ibQGYnOHyX9MfzCWqBNPl1Bu5iFm8AfNPv6WL6ohA079ixoOT 1mFBdVdOWWgx4aHWlHwf6uswF5sP5kKR506tJYEZN8snoRjUSGffO5B6Lb03F4wM4B9F/WsB7 CwFn11AEC72aU18eM2Pw4JpL8rIWOsF2L5W73BiCSFvjbdhRhDgQ16e25kCaTRD/gL9CcA+J0 be9dNdfQFmSs6W+3rMpGhtqaNA3lct5SZqSoIWCunf8NGa1L6l3fva5aRn14DX7tckzxdAB9f 4Xtm+1EHH52ApqhLikLRc9/nyxcs/xjKzlYBZpnXacD1dhjdF1GfxVGv4QlkbjERxjW66QA3z yho68eUSv0XxhnZjEra7JQ7Sh1CMLK+cGnVFf2F82zcul19OF2f9u9cj6xjH6x9T2r6DFPBqu Zi7T8E2xqzsIphIQCvjGuAniS2yUrmk7pZ0NDNj+gj1zRwbem8s93O5Btpl1TW24p5D9AApDG 8icq9NIYRGg3qZlpQho3JtAK81N7P2biDRKaLVPGn0ZNM/70TQLMJ5RHRm5bvPooB62qVLUZ+ YaQEq4A5nbhq7wga3aI5tnoypPVQ0fMtZpPgT6bH26w/TWQsEgRz8nPuI1Yy3FOHpk5OsB1GX 95GKyx0 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: Mon, 18 Jul 2016 16:06:18 +0200 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 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 39386f5..4e55863 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -146,9 +146,7 @@ static void ttm_bo_release_list(struct kref *list_kref) BUG_ON(bo->mem.mm_node != NULL); 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);