@@ -1452,7 +1452,6 @@ static void crypt_free_tfms(struct crypt_config *cc)
static int crypt_alloc_tfms(struct crypt_config *cc, char *ciphermode)
{
unsigned i;
- int err;
cc->tfms = kcalloc(cc->tfms_count, sizeof(*cc->tfms), GFP_KERNEL);
if (!cc->tfms)
@@ -1461,7 +1460,8 @@ static int crypt_alloc_tfms(struct crypt_config *cc, char *ciphermode)
for (i = 0; i < cc->tfms_count; i++) {
cc->tfms[i] = crypto_alloc_skcipher(ciphermode, 0, 0);
if (IS_ERR(cc->tfms[i])) {
- err = PTR_ERR(cc->tfms[i]);
+ int err = PTR_ERR(cc->tfms[i]);
+
crypt_free_tfms(cc);
return err;
}