Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp274624pxf; Thu, 1 Apr 2021 00:22:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4l4IkQu86ZAaXIkLatNjV/FZ3ClmWn4GATxD8KGQtDXKG1IFSgPQbVCSay/VQ75ZoHcgM X-Received: by 2002:a17:906:2314:: with SMTP id l20mr7843423eja.178.1617261732381; Thu, 01 Apr 2021 00:22:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617261732; cv=none; d=google.com; s=arc-20160816; b=yV2E80C856646t9IsdM4zmKT2C8TuNG4png+QwJJpQUppeEW82sVkNsWLC51oDkwwI ehJwu8FEB1F3rJ7LjrHMU6S9hOQjkCjmllKkaY0E0s/BA1jOoLV/VO/pdUsCtyxRYLcz 7FiAoMNgV1YSFnGIcrzvspEINOzLAJeZscqccxEOmPsVSgK0M0lqXVIr0d+pHfZQjqTz brSzUh7UQs3CoSlEIUz2Y0KDT1ipwc39ebfPwEESsBuI6zIWNP7JSCfwQKTPeQy1T33m 0UeIalNOeTv09R2iGkFRofRxSOhHq5GtQYSuFrnZ7sB61p+3A5xsDozM6i6K7xmU6Bsz OTOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=u2xIFX8U8NparO0j2GyLaRIqg05VR4STCqf5n6bz6r8=; b=RGa9CihKlZ1jWAHuSi2VBbsnN+pd0A0z/ofISeqTecp7CUP2uXqChIpbTpqJtct0xf kUCNIM4aq5MxNL7OYnkZW2+fl79GWLgIkOIRTTuk2pljAQ6MQfo2I+mkutVaC/gas2cV nmAKitfCsMXZ5pTWK5mCy2sFnyPYdJdK/ZK2neqdIgmTodu/APm8trd6lLtxoZi2cIfi vbAaYqGUk8+LWdJNMR/Qm7zSnRXV1242u10ITc6WepqPvzRnVT+xOYWPPpSeeRQaSLyO 1bNrJwWOajPL7RTObsz+3QfkxfSLAKysbiv0Xh7SAF6G4pQqL5HamrcJPi6AOoJJWx8Q IBUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cx24si3599020edb.541.2021.04.01.00.21.40; Thu, 01 Apr 2021 00:22:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229850AbhDAHUz (ORCPT + 99 others); Thu, 1 Apr 2021 03:20:55 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:14661 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233580AbhDAHUk (ORCPT ); Thu, 1 Apr 2021 03:20:40 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4F9vfG2VVNznWyN; Thu, 1 Apr 2021 15:17:58 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.498.0; Thu, 1 Apr 2021 15:20:29 +0800 From: Zhiqi Song To: , CC: , , , , Subject: [PATCH] crypto: api - fix coding style Date: Thu, 1 Apr 2021 15:20:49 +0800 Message-ID: <1617261649-35947-1-git-send-email-songzhiqi1@huawei.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Fixed following checkpatch error: - do not use assignment in if condition Fixed following checkpatch warning: - prefer strscpy over strlcpy - delete repeated word Signed-off-by: Zhiqi Song --- crypto/api.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/crypto/api.c b/crypto/api.c index c4eda56..624e653 100644 --- a/crypto/api.c +++ b/crypto/api.c @@ -115,7 +115,7 @@ struct crypto_larval *crypto_larval_alloc(const char *name, u32 type, u32 mask) larval->alg.cra_priority = -1; larval->alg.cra_destroy = crypto_larval_destroy; - strlcpy(larval->alg.cra_name, name, CRYPTO_MAX_ALG_NAME); + strscpy(larval->alg.cra_name, name, CRYPTO_MAX_ALG_NAME); init_completion(&larval->completion); return larval; @@ -266,7 +266,7 @@ struct crypto_alg *crypto_alg_mod_lookup(const char *name, u32 type, u32 mask) /* * If the internal flag is set for a cipher, require a caller to - * to invoke the cipher with the internal flag to use that cipher. + * invoke the cipher with the internal flag to use that cipher. * Also, if a caller wants to allocate a cipher that may or may * not be an internal cipher, use type | CRYPTO_ALG_INTERNAL and * !(mask & CRYPTO_ALG_INTERNAL). @@ -359,9 +359,11 @@ struct crypto_tfm *__crypto_alloc_tfm(struct crypto_alg *alg, u32 type, if (err) goto out_free_tfm; - if (!tfm->exit && alg->cra_init && (err = alg->cra_init(tfm))) - goto cra_init_failed; - + if (!tfm->exit && alg->cra_init) { + err = alg->cra_init(tfm); + if (err) + goto cra_init_failed; + } goto out; cra_init_failed: @@ -458,9 +460,11 @@ void *crypto_create_tfm_node(struct crypto_alg *alg, if (err) goto out_free_tfm; - if (!tfm->exit && alg->cra_init && (err = alg->cra_init(tfm))) - goto cra_init_failed; - + if (!tfm->exit && alg->cra_init) { + err = alg->cra_init(tfm); + if (err) + goto cra_init_failed; + } goto out; cra_init_failed: -- 2.7.4