From patchwork Tue Nov 17 07:21:42 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: 7633691 Return-Path: X-Original-To: patchwork-linux-scsi@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 274E69F1D3 for ; Tue, 17 Nov 2015 07:22:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 46D9D20532 for ; Tue, 17 Nov 2015 07:22:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 734062052F for ; Tue, 17 Nov 2015 07:22:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751639AbbKQHWF (ORCPT ); Tue, 17 Nov 2015 02:22:05 -0500 Received: from mout.web.de ([212.227.15.3]:51225 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751151AbbKQHWC (ORCPT ); Tue, 17 Nov 2015 02:22:02 -0500 Received: from [192.168.1.3] ([77.182.159.196]) by smtp.web.de (mrweb001) with ESMTPSA (Nemesis) id 0M5Oql-1aIziW0vjL-00zaHM; Tue, 17 Nov 2015 08:21:55 +0100 Subject: [PATCH] SCSI-aic94xx: Delete unnecessary checks before the function call "kmem_cache_destroy" To: linux-scsi@vger.kernel.org, "James E. J. Bottomley" 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: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <564AD586.5040606@users.sourceforge.net> Date: Tue, 17 Nov 2015 08:21:42 +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:QMEwuDj8YGlsAhqWIyRsPnr59F73+2yFzJy3K8WfmAEdkThk04c IUyK0eo3PgFasXWYhK9jiwauYhkRZOD6mpdZTqg69zcOGmuHL6JeQjyCBFXuplgWVPQWjng hn8GTX2jIYIzpFw/AzV9cROzKCzbNk13MHId6zPbOQU8x1t/M4NyBvAMbzqbd1wLffeebGR 2rBoo4aecz4tPn4MQmLGA== X-UI-Out-Filterresults: notjunk:1; V01:K0:46RZeI+l5RU=:H2WobQN5TadTwqzJ78syD0 Q2lE+gE3EwX8zGQCihRLJ7AdsVALLucE1FQw+9h+POiVBQxtcKZ3akQm80WB5LYGgbyEo9WyU r/trwt1mCt96UtqP7nVM1fA6CD4GoVTmZxLGnJWlSmtStM7G1ku+xHCh/3Ogph36b137xjXDU bGerqwhhlgYyb5+wCbppUYQC8rwZ5Ul7NRQ4wgkRsmeaF4HaEijs8FXhe7f7lKsfQDDBcYxCZ OmymmcfkylNSu1iDma7hbaCK540p00KjCM62BWx8Ywj2dvJ0JyshS0JyAiquSWjyU8ya/MlJ8 9lY+D1EggQ9B3RIzw/OGhJ92tYRtA5AetNDzZrBeQqt+YcCAVGXnr/+I9NUAldE2oujEmpC/r ef658PtMGEHpA66w7pEgt6TUSUjoNjiigvw46N9IGAB5cKJXGcyz7PQPjOdl76L2+GLTROzSk xIGMQK+68TDjcLmv61g5dChsVHOHl5JFtPi0F94yqZitleAZ7s/D+V1lsKqQsFA9Y1qNkntsP GjcoLOwWR1ri3t23s6nWD0rLLB6GbsXrJ0qSlsiEjleoCd2voq/JT7nJniqkjqRom0UlsS4RL LDcrYPcA/vB6HdrjiTauA9DeKS95XkXJjNl8w3KeaPJk75wo4nmV7dA0r9lr+yxrCmDEu9Ar+ j+fhlhXHUfHyOx/3AErXAsBmBZwp7HEzd8OJWmYh7iul9M2U4ala6KTj4ilEhhAnm6sGZ/o6X BvVIeX1frVvCnxfb+Y+P6tteLuSt4MjCsF5B4LR1cVYSNaKcGYmCa4i/VedllaPYNgo6rOWV5 9W3Qd/G Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.5 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: Tue, 17 Nov 2015 08:14:52 +0100 The kmem_cache_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 Reviewed-by: Jack Wang --- drivers/scsi/aic94xx/aic94xx_init.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c index 662b232..ab93049 100644 --- a/drivers/scsi/aic94xx/aic94xx_init.c +++ b/drivers/scsi/aic94xx/aic94xx_init.c @@ -660,12 +660,9 @@ Err: static void asd_destroy_global_caches(void) { - if (asd_dma_token_cache) - kmem_cache_destroy(asd_dma_token_cache); + kmem_cache_destroy(asd_dma_token_cache); asd_dma_token_cache = NULL; - - if (asd_ascb_cache) - kmem_cache_destroy(asd_ascb_cache); + kmem_cache_destroy(asd_ascb_cache); asd_ascb_cache = NULL; }