* [PATCH] crypto: api - fix coding style
@ 2021-04-01 7:20 Zhiqi Song
2021-04-09 7:27 ` Herbert Xu
0 siblings, 1 reply; 3+ messages in thread
From: Zhiqi Song @ 2021-04-01 7:20 UTC (permalink / raw)
To: herbert, davem
Cc: linux-crypto, linux-kernel, wangzhou1, fanghao11, prime.zeng
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 <songzhiqi1@huawei.com>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: api - fix coding style
2021-04-01 7:20 [PATCH] crypto: api - fix coding style Zhiqi Song
@ 2021-04-09 7:27 ` Herbert Xu
2021-04-09 8:59 ` songzhiqi (A)
0 siblings, 1 reply; 3+ messages in thread
From: Herbert Xu @ 2021-04-09 7:27 UTC (permalink / raw)
To: Zhiqi Song
Cc: davem, linux-crypto, linux-kernel, wangzhou1, fanghao11, prime.zeng
On Thu, Apr 01, 2021 at 03:20:49PM +0800, Zhiqi Song wrote:
> 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 <songzhiqi1@huawei.com>
> ---
> crypto/api.c | 20 ++++++++++++--------
> 1 file changed, 12 insertions(+), 8 deletions(-)
Please don't mix unrelated changes in a single patch.
Thanks,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: api - fix coding style
2021-04-09 7:27 ` Herbert Xu
@ 2021-04-09 8:59 ` songzhiqi (A)
0 siblings, 0 replies; 3+ messages in thread
From: songzhiqi (A) @ 2021-04-09 8:59 UTC (permalink / raw)
To: Herbert Xu
Cc: davem, linux-crypto, linux-kernel, wangzhou1, fanghao11, prime.zeng
On 2021/4/9 15:27, Herbert Xu wrote:
> On Thu, Apr 01, 2021 at 03:20:49PM +0800, Zhiqi Song wrote:
>> 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 <songzhiqi1@huawei.com>
>> ---
>> crypto/api.c | 20 ++++++++++++--------
>> 1 file changed, 12 insertions(+), 8 deletions(-)
>
> Please don't mix unrelated changes in a single patch.
>
> Thanks,
>
OK, I will split this patch.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-09 9:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-01 7:20 [PATCH] crypto: api - fix coding style Zhiqi Song
2021-04-09 7:27 ` Herbert Xu
2021-04-09 8:59 ` songzhiqi (A)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).