From patchwork Fri Jun 26 18:45:28 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: 6682641 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 9BB32C05AC for ; Fri, 26 Jun 2015 18:46:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AD0B820647 for ; Fri, 26 Jun 2015 18:46:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C50B62063B for ; Fri, 26 Jun 2015 18:46:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752252AbbFZSp7 (ORCPT ); Fri, 26 Jun 2015 14:45:59 -0400 Received: from mout.web.de ([212.227.15.14]:49651 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752182AbbFZSp4 (ORCPT ); Fri, 26 Jun 2015 14:45:56 -0400 Received: from [192.168.1.3] ([92.228.38.32]) by smtp.web.de (mrweb003) with ESMTPSA (Nemesis) id 0MAMkU-1ZFjdy2xkg-00Bahg; Fri, 26 Jun 2015 20:45:36 +0200 Message-ID: <558D9DC8.2000603@users.sourceforge.net> Date: Fri, 26 Jun 2015 20:45:28 +0200 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: "David S. Miller" , Herbert Xu , Tadeusz Struk , qat-linux@intel.com, linux-crypto@vger.kernel.org CC: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Subject: [PATCH] crypto-qat: Deletion of unnecessary checks before two function calls 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> In-Reply-To: <5317A59D.4@users.sourceforge.net> X-Provags-ID: V03:K0:PV68g5rMHYGLDS184v1ku2NMR7lbFv+JnWeq2IjkZ1OFH7nhxVb c1RM4GG6UuNYqLo0Vo50bSOXqc5HWxg5tK2lIfzlCp7bz0zXDxjfk3/PVMdveFoCrjMMrDP T/EQJT1ht1z3nU/kZqyLUO6XrGJk5S4sFq2adKdhek9xoipdi/Ac9L+eg5NKbGwwbJWy+mm UZEEibSGnYcOxENWSlPBw== X-UI-Out-Filterresults: notjunk:1; V01:K0:9RnYyK8k6ks=:PO6c5vSX6Yp4PjeIKbXusY wzkTvD4NkIrDRhSQoLcf4AN5U6l7wurOsY5TAjLDPgDPq2hNTAfR3RNYnNsLPQ1Tzom7lvKuK 51VfQFZeBqy4w/Won7YFneSRE8of80Dy79FzFoEJAK5tSQgXMKH00cTed/uWWrZpu0dVDYch1 ARJhQewUyyzC6HXbqvyJsST07twkjWGbE1k6xchXU7sicP2b/XKRy1ORXqzvt+BT/FeSy00mQ xINW3PKhZpDYtfmv21vcppJLc/qp7G/tAef2XWDY3da8xEh3SMjTPaTFij225rwy7U3hX+xfv ezKuHyHjtYZLCRNm4gOgU5bDgmDk2Qvcau1DCsPtgIbtEYFqSO+y7LwXj8C3Z+z5PtLmWFPkW 9Q/OS4bOZ+s6372E1pPzAV0LiT56xVSJ6uybCxNSqujrm9R5eFlB54fTSr3Cw+5bFpXHQ1Fcj /Mr/fXJ8Wcex6/i3hlLCFTBPFWvjAoH7b1eKH8mvbNV4JpubIJ6sIssmG2E7Xz9npIvzJkxei 8BwTjDsHAhdVbSGzh+SB5vekOQPscHJEd6nClkvJaILCNRL8vJUNOlwSgow2JitS7GrFftJtP tOURssdFLemHMKrA7kJko6yGruD9aK8of+h9dEbJZX0fmnalXaGLmTLolG+WxplxCagKkRMF/ RnvR7VKrS0e4tsgHo/B64hJbNF1aimehFiSvFGvYuSdkkmmva/GtvCyIVS7b05UbOrMQ= Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-8.3 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: Fri, 26 Jun 2015 20:30:11 +0200 The functions kfree() and release_firmware() test whether their argument is NULL and then return 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/qat/qat_common/adf_accel_engine.c | 5 +---- drivers/crypto/qat/qat_common/adf_transport.c | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/qat/qat_common/adf_accel_engine.c b/drivers/crypto/qat/qat_common/adf_accel_engine.c index 7f8b66c..fdda8e7 100644 --- a/drivers/crypto/qat/qat_common/adf_accel_engine.c +++ b/drivers/crypto/qat/qat_common/adf_accel_engine.c @@ -88,10 +88,7 @@ void adf_ae_fw_release(struct adf_accel_dev *accel_dev) qat_uclo_del_uof_obj(loader_data->fw_loader); qat_hal_deinit(loader_data->fw_loader); - - if (loader_data->uof_fw) - release_firmware(loader_data->uof_fw); - + release_firmware(loader_data->uof_fw); loader_data->uof_fw = NULL; loader_data->fw_loader = NULL; } diff --git a/drivers/crypto/qat/qat_common/adf_transport.c b/drivers/crypto/qat/qat_common/adf_transport.c index ccec3274..db2926b 100644 --- a/drivers/crypto/qat/qat_common/adf_transport.c +++ b/drivers/crypto/qat/qat_common/adf_transport.c @@ -449,7 +449,7 @@ static int adf_init_bank(struct adf_accel_dev *accel_dev, err: for (i = 0; i < ADF_ETR_MAX_RINGS_PER_BANK; i++) { ring = &bank->rings[i]; - if (hw_data->tx_rings_mask & (1 << i) && ring->inflights) + if (hw_data->tx_rings_mask & (1 << i)) kfree(ring->inflights); } return -ENOMEM;