Skip to content

Commit e2b19a4

Browse files
Chen Yufanherbertx
authored andcommitted
crypto: camm/qi - Use ERR_CAST() to return error-valued pointer
Instead of directly casting and returning (void *) pointer, use ERR_CAST to explicitly return an error-valued pointer. This makes the error handling more explicit and improves code clarity. Signed-off-by: Chen Yufan <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent ca459e5 commit e2b19a4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/crypto/caam/caamalg_qi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ static struct aead_edesc *aead_edesc_alloc(struct aead_request *req,
961961

962962
drv_ctx = get_drv_ctx(ctx, encrypt ? ENCRYPT : DECRYPT);
963963
if (IS_ERR(drv_ctx))
964-
return (struct aead_edesc *)drv_ctx;
964+
return ERR_CAST(drv_ctx);
965965

966966
/* allocate space for base edesc and hw desc commands, link tables */
967967
edesc = qi_cache_alloc(flags);
@@ -1271,7 +1271,7 @@ static struct skcipher_edesc *skcipher_edesc_alloc(struct skcipher_request *req,
12711271

12721272
drv_ctx = get_drv_ctx(ctx, encrypt ? ENCRYPT : DECRYPT);
12731273
if (IS_ERR(drv_ctx))
1274-
return (struct skcipher_edesc *)drv_ctx;
1274+
return ERR_CAST(drv_ctx);
12751275

12761276
src_nents = sg_nents_for_len(req->src, req->cryptlen);
12771277
if (unlikely(src_nents < 0)) {

0 commit comments

Comments
 (0)