From patchwork Tue Nov 17 15:41:40 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: 7638381 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@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 DB019BF90C for ; Tue, 17 Nov 2015 15:42:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 082F8204E4 for ; Tue, 17 Nov 2015 15:42:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DE12E204D6 for ; Tue, 17 Nov 2015 15:41:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751600AbbKQPl5 (ORCPT ); Tue, 17 Nov 2015 10:41:57 -0500 Received: from mout.web.de ([212.227.17.11]:50539 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750888AbbKQPl4 (ORCPT ); Tue, 17 Nov 2015 10:41:56 -0500 Received: from [192.168.1.3] ([77.182.159.196]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0MGRVU-1aBxv61iIi-00DCX9; Tue, 17 Nov 2015 16:41:44 +0100 Subject: [PATCH v2 1/3] crypto-ixp4xx: Delete unnecessary checks before the function call "dma_pool_destroy" To: linux-crypto@vger.kernel.org, Herbert Xu , "David S. Miller" 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> <5648D2C1.8050603@users.sourceforge.net> <564B489F.10308@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <564B4AB4.3010709@users.sourceforge.net> Date: Tue, 17 Nov 2015 16:41:40 +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: <564B489F.10308@users.sourceforge.net> X-Provags-ID: V03:K0:k91NOuGSTHkX3+WvHhIgfjwLESSZ8AqPVqwmI6W9eeZl5TmnQZ5 CtpJyawNr5oP+QBvas8KvN6WvQei6oUaAkqnilxmeInBXYrc7+GtgB1M3c9rdC9rzXXDmrN UDH5oA7xOQfbIAoKBKzkmCq79Ig605hRHfLJoGzx/qjpM6SxcC19A64nIcO8zs/r8NWB/Pw Cvas83pv7EZZ9KnDtV+Wg== X-UI-Out-Filterresults: notjunk:1; V01:K0:S7CYoBelZW8=:4TDeAOLtIet59mYnTr6aKk yVinMO1io71D2eQAADcq3rXd1Pmaex0Va+PI03mywYBkL/e9B0RiBHWvuBW+V2gPU/rgp+w63 wLPam7hIGI/JD5d273YmI9M8CHlgKfK4rRrKd7YXTT7wHzG3NwE6pLNPlJMy7FECk7l9SOYpr Mgt/wRCInBYsax6ybSsGPeF1WVIueFsJavR1JvERU5tRQkRJmdhyEeq/vFeB/C5wHssHXNBiu 2ug+3b3PEvphjG+dcuCEJSKiV9eftG/3rUTqV/aJewQRm8MXFRkR1//9vf11aAyrYdathbWce 7DtA3RTX6QKoat78e6G4qOZMTJq/cfMuoQNCXNpwtyn/wNnhbxwttKZunr8sqOCd/CRd6zYnu PJXkmsDqfABlvg6/ZEjWWleKCbW+25WjUcGOFIyeGSRQBzdlvcV365wwrXhmXdRnXhMTmKXBv vR4M/+AIyPclF43L79tukbo9ZaUZK2keONXluwuu5/GwM8O96smZTkneOQ6bBzg9eyBKT7ySe iZK5XCOSRG2yfceALeEGGwPwgeOjJINPITwzw+XJmOLwHIW9JVbVsu8GeKGyqSl75xKFQRP4P 5UrIsGn3MOSzFdUvbplUbtYBGvvOaCz8xCourediD4e6iJYU7OBIGR8XlfWxYvn+4xKiZKgss lCGVyTt7leFr4GBl+a2tVOn8rJjEz3BJqBG36rQ0OqASi+k5QCz67jFlhFz+6smCi60X3gzkR jiJJODGhWTpq0aDXr83WNLwNmybvk/4cyADssscX1XiU+ZKv5eRs/ht7QRkvqxieLxRnrIRcv ad1nhJf Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@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: Sun, 15 Nov 2015 16:51:21 +0100 The dma_pool_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 --- drivers/crypto/ixp4xx_crypto.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c index 8f27903..e52496a 100644 --- a/drivers/crypto/ixp4xx_crypto.c +++ b/drivers/crypto/ixp4xx_crypto.c @@ -510,10 +510,8 @@ npe_error: printk(KERN_ERR "%s not responding\n", npe_name(npe_c)); ret = -EIO; err: - if (ctx_pool) - dma_pool_destroy(ctx_pool); - if (buffer_pool) - dma_pool_destroy(buffer_pool); + dma_pool_destroy(ctx_pool); + dma_pool_destroy(buffer_pool); npe_release(npe_c); return ret; }