From patchwork Mon Nov 16 08:45:41 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: 7621791 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 582179F2E2 for ; Mon, 16 Nov 2015 08:46:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8E9E0204D8 for ; Mon, 16 Nov 2015 08:46:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BA965204D5 for ; Mon, 16 Nov 2015 08:46:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752113AbbKPIpz (ORCPT ); Mon, 16 Nov 2015 03:45:55 -0500 Received: from mout.web.de ([212.227.17.12]:56641 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751124AbbKPIpy (ORCPT ); Mon, 16 Nov 2015 03:45:54 -0500 Received: from [192.168.1.3] ([77.181.163.50]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0MaJvw-1ZeWht0th2-00Ju6n; Mon, 16 Nov 2015 09:45:45 +0100 Subject: [PATCH] SCSI-libfc: Delete an unnecessary check before the function call "kmem_cache_destroy" 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> To: "James E. J. Bottomley" , fcoe-devel@open-fcoe.org, linux-scsi@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <564997B5.6030703@users.sourceforge.net> Date: Mon, 16 Nov 2015 09:45:41 +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:eU+0LJ1ewLACOBy5HlbDz6YEuwFhcN0AyT7V9ZivB7Bk9W4BCXW rCuSRsNDrt4nbMCEMGlQJNdfQKqGwuRnJLR6LfuLZ8yUZLkVDGx0HO8s99LBYgOMUEBh+n+ Pm9pv6GuIVoGxSh+ebO8RCFntREhtPDCGYBGohFRJnDIkcvaiaOaCGXfAB04zCCcZFjG1TN 3hala+chx0OgtddyoCeCQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:o0IVGyC8aCE=:xn6BlzpYFe2ZfUPAVpAtVP IcFGS1VHPD1r24821eKcfpOrwCNZdvba8eyECNBkNbOBy/VeCq6mbWxtHHkGiXxa+O90X82kZ 55SQzlVvRsCFxTg6udBr2iMT11z96POkp/0tjgIEG9XuioSztMZZeD9RGb4CTZ/JNXN/sCJ1R AaYfjtZAxQSdxpqufx4LIebHFTD4qtGNGc9pukP77ZcRGhUqhVMKbh0o1cvRYz0V7oRF8hMLR aN/8zkB2nXSUkOaT7WhL8fkjJXgXiRgyzJIvgJ8Z9XlDqvwJ1iOq+FH8Li1WGsDEbVWriVKZj ZGxNsxQ+rmZx6+EjC4EMfafxiGal2ozQg1r3Bnm3X45oHcdpIKiWCSQ8HIHJjoUMsX+Icu6zr m3qq4Fs2/zyRebeLw7T1OKD3Sw0fT4KFKZu5tGeBC6K1YqwmYJOHVEpJB+mklS6EaQ3RMmvht 2f0jA7MPGkSXr4ZkYYlPVZWfXB0dREgh9wvTr3iaK56CX28yL9MwuU8zGP71M6kEf7UhdrH9T uy1kc4CH6Uo2tV/vvoi5jADkvGoLLbqh9jed18hLL9xNZg0GWMW/khPUOVNd0tPT5as3IrSCx doFKGywl5CGSc0JWItirWeEMjtJWtkWnBeFr8N00FjwDfvje5g9ZwVajUieReGU7C6/GiFfV3 WbAhM2E861i9VvzjBT77c3kvkX32ejh3SOW+TaPLgFgvml33VUgbBqd2OSVkE5DLg81QZ0iy+ yGoFzUkOOf/IClox2dYPvr+IqdvjVqEYdxPO+tmmjD4T334Fl0f67ioyxdO/PxGFsXUe7hhe3 igtmWoq 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.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 09:39:12 +0100 The kmem_cache_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 Acked-by: Vasu Dev --- drivers/scsi/libfc/fc_fcp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c index 5121272..d377514 100644 --- a/drivers/scsi/libfc/fc_fcp.c +++ b/drivers/scsi/libfc/fc_fcp.c @@ -2216,8 +2216,7 @@ int fc_setup_fcp(void) void fc_destroy_fcp(void) { - if (scsi_pkt_cachep) - kmem_cache_destroy(scsi_pkt_cachep); + kmem_cache_destroy(scsi_pkt_cachep); } /**