Skip to content

Commit 43fd83c

Browse files
Eric BiggersMikulas Patocka
authored andcommitted
dm-crypt: Make crypt_iv_operations::post return void
Since all implementations of crypt_iv_operations::post now return 0, change the return type to void. Signed-off-by: Eric Biggers <ebiggers@kernel.org> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
1 parent a1cf2bd commit 43fd83c

1 file changed

Lines changed: 13 additions & 18 deletions

File tree

drivers/md/dm-crypt.c

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ struct crypt_iv_operations {
113113
void (*wipe)(struct crypt_config *cc);
114114
int (*generator)(struct crypt_config *cc, u8 *iv,
115115
struct dm_crypt_request *dmreq);
116-
int (*post)(struct crypt_config *cc, u8 *iv,
117-
struct dm_crypt_request *dmreq);
116+
void (*post)(struct crypt_config *cc, u8 *iv,
117+
struct dm_crypt_request *dmreq);
118118
};
119119

120120
struct iv_benbi_private {
@@ -559,14 +559,14 @@ static int crypt_iv_lmk_gen(struct crypt_config *cc, u8 *iv,
559559
return 0;
560560
}
561561

562-
static int crypt_iv_lmk_post(struct crypt_config *cc, u8 *iv,
563-
struct dm_crypt_request *dmreq)
562+
static void crypt_iv_lmk_post(struct crypt_config *cc, u8 *iv,
563+
struct dm_crypt_request *dmreq)
564564
{
565565
struct scatterlist *sg;
566566
u8 *dst;
567567

568568
if (bio_data_dir(dmreq->ctx->bio_in) == WRITE)
569-
return 0;
569+
return;
570570

571571
sg = crypt_get_sg_data(cc, dmreq->sg_out);
572572
dst = kmap_local_page(sg_page(sg));
@@ -576,7 +576,6 @@ static int crypt_iv_lmk_post(struct crypt_config *cc, u8 *iv,
576576
crypto_xor(dst + sg->offset, iv, cc->iv_size);
577577

578578
kunmap_local(dst);
579-
return 0;
580579
}
581580

582581
static void crypt_iv_tcw_dtr(struct crypt_config *cc)
@@ -684,22 +683,20 @@ static int crypt_iv_tcw_gen(struct crypt_config *cc, u8 *iv,
684683
return 0;
685684
}
686685

687-
static int crypt_iv_tcw_post(struct crypt_config *cc, u8 *iv,
688-
struct dm_crypt_request *dmreq)
686+
static void crypt_iv_tcw_post(struct crypt_config *cc, u8 *iv,
687+
struct dm_crypt_request *dmreq)
689688
{
690689
struct scatterlist *sg;
691690
u8 *dst;
692691

693692
if (bio_data_dir(dmreq->ctx->bio_in) != WRITE)
694-
return 0;
693+
return;
695694

696695
/* Apply whitening on ciphertext */
697696
sg = crypt_get_sg_data(cc, dmreq->sg_out);
698697
dst = kmap_local_page(sg_page(sg));
699698
crypt_iv_tcw_whitening(cc, dmreq, dst + sg->offset);
700699
kunmap_local(dst);
701-
702-
return 0;
703700
}
704701

705702
static int crypt_iv_random_gen(struct crypt_config *cc, u8 *iv,
@@ -994,13 +991,11 @@ static int crypt_iv_elephant_gen(struct crypt_config *cc, u8 *iv,
994991
return crypt_iv_eboiv_gen(cc, iv, dmreq);
995992
}
996993

997-
static int crypt_iv_elephant_post(struct crypt_config *cc, u8 *iv,
998-
struct dm_crypt_request *dmreq)
994+
static void crypt_iv_elephant_post(struct crypt_config *cc, u8 *iv,
995+
struct dm_crypt_request *dmreq)
999996
{
1000997
if (bio_data_dir(dmreq->ctx->bio_in) != WRITE)
1001998
crypt_iv_elephant(cc, dmreq);
1002-
1003-
return 0;
1004999
}
10051000

10061001
static int crypt_iv_elephant_init(struct crypt_config *cc)
@@ -1346,7 +1341,7 @@ static int crypt_convert_block_aead(struct crypt_config *cc,
13461341
}
13471342

13481343
if (!r && cc->iv_gen_ops && cc->iv_gen_ops->post)
1349-
r = cc->iv_gen_ops->post(cc, org_iv, dmreq);
1344+
cc->iv_gen_ops->post(cc, org_iv, dmreq);
13501345

13511346
bio_advance_iter(ctx->bio_in, &ctx->iter_in, cc->sector_size);
13521347
bio_advance_iter(ctx->bio_out, &ctx->iter_out, cc->sector_size);
@@ -1423,7 +1418,7 @@ static int crypt_convert_block_skcipher(struct crypt_config *cc,
14231418
r = crypto_skcipher_decrypt(req);
14241419

14251420
if (!r && cc->iv_gen_ops && cc->iv_gen_ops->post)
1426-
r = cc->iv_gen_ops->post(cc, org_iv, dmreq);
1421+
cc->iv_gen_ops->post(cc, org_iv, dmreq);
14271422

14281423
bio_advance_iter(ctx->bio_in, &ctx->iter_in, cc->sector_size);
14291424
bio_advance_iter(ctx->bio_out, &ctx->iter_out, cc->sector_size);
@@ -2187,7 +2182,7 @@ static void kcryptd_async_done(void *data, int error)
21872182
}
21882183

21892184
if (!error && cc->iv_gen_ops && cc->iv_gen_ops->post)
2190-
error = cc->iv_gen_ops->post(cc, org_iv_of_dmreq(cc, dmreq), dmreq);
2185+
cc->iv_gen_ops->post(cc, org_iv_of_dmreq(cc, dmreq), dmreq);
21912186

21922187
if (error == -EBADMSG) {
21932188
sector_t s = le64_to_cpu(*org_sector_of_dmreq(cc, dmreq));

0 commit comments

Comments
 (0)