From patchwork Mon Nov 16 07:28:55 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: 7621371 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9C3849F2EC for ; Mon, 16 Nov 2015 07:29:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C5E0C205BE for ; Mon, 16 Nov 2015 07:29:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E5288205B8 for ; Mon, 16 Nov 2015 07:29:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751469AbbKPH3K (ORCPT ); Mon, 16 Nov 2015 02:29:10 -0500 Received: from mout.web.de ([212.227.17.12]:50262 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751397AbbKPH3J (ORCPT ); Mon, 16 Nov 2015 02:29:09 -0500 Received: from [192.168.1.3] ([77.181.163.50]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0M7bYJ-1aLXwE1xCB-00xMdN; Mon, 16 Nov 2015 08:29:05 +0100 Subject: [PATCH] sh-DWARF: Delete unnecessary checks before the function call "mempool_destroy" To: linux-kernel@vger.kernel.org, linux-sh@vger.kernel.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> Cc: kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <564985B7.3080806@users.sourceforge.net> Date: Mon, 16 Nov 2015 08:28:55 +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:Cf5SylpDuoHXOLNN3GhmtvRUSerQQhQzl1dvYF/oja36ZgvV89O 8rmIi12c53u8wgkdOgdylzadT/eKM3jnLsZjl7YDmDzKQSQEcu3rSLOth3mdB/6A628PnE5 GJbJ/+OYoa8Hfkr4WF3FrRFrMDZtV0JhJm7zxrbY5PhgE8wFAPRVFkyf7ZXOpKvegxTL+78 ivjzLmKHFvu88d01JC8WQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:nZ6rH9vIGDE=:o7TE9Vgd6XRvfEWy26xm7D vjDvuRDBXHb79Ce05AVZvRHZhk+fkC/EhWL2rn2XCwgi9PdfV+7UlUL0vauU8Rbaf63Daw4z4 Xbzq9iog/UFagSxn8X05nkaGPJHVjaAJrD3hsv3Ms2sQlR5hlgfSaIDHLmm5VrMSJVLnrcCwu 3TvSKigleTVMOTpYGmmXjVJu2nGTGMDcHCAsPXGqYQU6S5xJrO1/ww4QVY/yOlw4b3Mc+qxF4 ONUVt9ItA3De6s4Yrss6n4HtBgnxtvChFDQEP36NBEfPMDM6W0F9dZF+to9t3hekVmY1Xmpze FzOJnTWfOFlQ4YH/gW7QZqJ+MFmh/FGThSObjsuRoOPcv44UTEeT0p0STpr5KOe5bK4zocJOA 5zhNKmj6qfZ1rlUrnrXLulq+LdyQaWQ3xGa9Wjk05iLERoLfOxwYr4o5aLL2+OFCI1th1MMey R8gBTVEjL2S2kWHLS4iUOt+hMddbn055oFxQ1wyN0WoRiwHcQByIs6HFSLUTOsPlzS/ARR6S9 f97BY87pkD3GEoFb7+r0AZ7DxoyDG6gmdCcaaKeQSVOuAWfED1SmlFK2ncVk61gfbUEVzjJ28 j6/X8hvrHxuy5XbKpZuYvxiOwr7vmjZIfBtKXaU9NZzj7blEOLl4FUkkbWXL6xsctvfMLxJDy qUlokp5CxM1foR7E3iqUTa2o0nKxnOZBCI1G3xL68Hkw3cWQ8cZzwlAqsaeV/rv6xqZOKFSFy bKYNmYtTXQriswxQzZxZTsE0wQL7AG1ia/Hzt/KUbC6HqL7hONce6lRHyF3Sb2qj44wC8I7X7 rLC/6kn Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 08:20:36 +0100 The mempool_destroy() function tests whether its argument is NULL and then returns immediately. Thus the test around the calls is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- arch/sh/kernel/dwarf.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/sh/kernel/dwarf.c b/arch/sh/kernel/dwarf.c index 9d209a0..e1d751a 100644 --- a/arch/sh/kernel/dwarf.c +++ b/arch/sh/kernel/dwarf.c @@ -1009,10 +1009,8 @@ static void __init dwarf_unwinder_cleanup(void) rbtree_postorder_for_each_entry_safe(cie, next_cie, &cie_root, node) kfree(cie); - if (dwarf_reg_pool) - mempool_destroy(dwarf_reg_pool); - if (dwarf_frame_pool) - mempool_destroy(dwarf_frame_pool); + mempool_destroy(dwarf_reg_pool); + mempool_destroy(dwarf_frame_pool); kmem_cache_destroy(dwarf_reg_cachep); kmem_cache_destroy(dwarf_frame_cachep); }