Skip to content

Commit 5e91f56

Browse files
Colin Ian Kingherbertx
authored andcommitted
crypto: img-hash - remove need for error return variable ret
The assignment to error return variable ret and then the jump to an error exit path can be simplified by just returning the error return at the failure point. This allows variable ret and the error return path to be removed. This cleans up a static analysis warninng that variable ret is being assigned (value never being used) and being re-assigned later. Addresses-Coverity: ("Unused value") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 29601c8 commit 5e91f56

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

drivers/crypto/img-hash.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -674,24 +674,19 @@ static int img_hash_digest(struct ahash_request *req)
674674
static int img_hash_cra_init(struct crypto_tfm *tfm, const char *alg_name)
675675
{
676676
struct img_hash_ctx *ctx = crypto_tfm_ctx(tfm);
677-
int err = -ENOMEM;
678677

679678
ctx->fallback = crypto_alloc_ahash(alg_name, 0,
680679
CRYPTO_ALG_NEED_FALLBACK);
681680
if (IS_ERR(ctx->fallback)) {
682681
pr_err("img_hash: Could not load fallback driver.\n");
683-
err = PTR_ERR(ctx->fallback);
684-
goto err;
682+
return PTR_ERR(ctx->fallback);
685683
}
686684
crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
687685
sizeof(struct img_hash_request_ctx) +
688686
crypto_ahash_reqsize(ctx->fallback) +
689687
IMG_HASH_DMA_THRESHOLD);
690688

691689
return 0;
692-
693-
err:
694-
return err;
695690
}
696691

697692
static int img_hash_cra_md5_init(struct crypto_tfm *tfm)

0 commit comments

Comments
 (0)