crypto: document correct return value for request allocation
Subsystems (2)
PATCH 1/1 crypto: document correct return value for request allocation
Signed-off-by Eric Biggers <[email protected]>
--- Documentation/DocBook/crypto-API.tmpl | 6 +++--- include/crypto/aead.h | 3 +-- include/crypto/hash.h | 3 +-- include/crypto/skcipher.h | 3 +-- include/linux/crypto.h | 3 +-- 5 files changed, 7 insertions(+), 11 deletions(-)
Documentation/DocBook/crypto-API.tmpl +3 -3
@@ -1936,9 +1936,9 @@ static int test_skcipher(void) } req = skcipher_request_alloc(skcipher, GFP_KERNEL); - if (IS_ERR(req)) { - pr_info("could not allocate request queue\n"); - ret = PTR_ERR(req); + if (!req) { + pr_info("could not allocate skcipher request\n"); + ret = -ENOMEM; goto out; }
include/crypto/aead.h +1 -2
@@ -405,8 +405,7 @@ static inline void aead_request_set_tfm(struct aead_request *req,* encrypt and decrypt API calls. During the allocation, the provided aead * handle is registered in the request data structure. * -* Return: allocated request handle in case of success; IS_ERR() is true in case -* of an error, PTR_ERR() returns the error code. +* Return: allocated request handle in case of success, or NULL if out of memory */ static inline struct aead_request *aead_request_alloc (struct crypto_aead *tfm,gfp_t gfp)
include/crypto/hash.h +1 -2
@@ -547,8 +547,7 @@ static inline void ahash_request_set_tfm(struct ahash_request *req,* the allocation, the provided ahash handle * is registered in the request data structure. * -* Return: allocated request handle in case of success; IS_ERR() is true in case -* of an error, PTR_ERR() returns the error code. +* Return: allocated request handle in case of success, or NULL if out of memory */ static inline struct ahash_request *ahash_request_alloc (struct crypto_ahash *tfm,gfp_t gfp)
include/crypto/skcipher.h +1 -2
@@ -425,8 +425,7 @@ static inline struct skcipher_request *skcipher_request_cast(* encrypt and decrypt API calls. During the allocation, the provided skcipher * handle is registered in the request data structure. * -* Return: allocated request handle in case of success; IS_ERR() is true in case -* of an error, PTR_ERR() returns the error code. +* Return: allocated request handle in case of success, or NULL if out of memory */ static inline struct skcipher_request *skcipher_request_alloc (struct crypto_skcipher *tfm,gfp_t gfp)
include/linux/crypto.h +1 -2
@@ -948,8 +948,7 @@ static inline struct ablkcipher_request *ablkcipher_request_cast(* encrypt and decrypt API calls. During the allocation, the provided ablkcipher * handle is registered in the request data structure. * -* Return: allocated request handle in case of success; IS_ERR() is true in case -* of an error, PTR_ERR() returns the error code. +* Return: allocated request handle in case of success, or NULL if out of memory */ static inline struct ablkcipher_request *ablkcipher_request_alloc (struct crypto_ablkcipher *tfm,gfp_t gfp)
Signature · 1 line
2.7.4
Quoted 15 lines · Eric Biggers
Signed-off-by Eric Biggers <[email protected]>--- Documentation/DocBook/crypto-API.tmpl | 6 +++--- include/crypto/aead.h | 3 +-- include/crypto/hash.h | 3 +-- include/crypto/skcipher.h | 3 +-- include/linux/crypto.h | 3 +-- 5 files changed, 7 insertions(+), 11 deletions(-)Documentation/DocBook/crypto-API.tmpl +0
-0@@ -1936,9 +1936,9 @@ static int test_skcipher(void) }
Documentation/DocBook/crypto-API.tmpl static int test_skcipher(void) · line 1943
Quoted 10 lines
Documentation/DocBook/crypto-API.tmpl +3
-3req = skcipher_request_alloc(skcipher, GFP_KERNEL); - if (IS_ERR(req)) { - pr_info("could not allocate request queue\n"); - ret = PTR_ERR(req); + if (!req) { + pr_info("could not allocate skcipher request\n"); + ret = -ENOMEM; goto out; }
Hello
I think pr_err is better than pr_info.
Regards
Quoted 1 line · Eric Biggers
Signed-off-by Eric Biggers <[email protected]>
Applied.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt