dm-crypt: move error handling to crypt_convert. This patch moves error handling to crypt_convert and makes crypt_convert return void instead of the error number. Signed-off-by: Mikulas Patocka --- drivers/md/dm-crypt.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) Index: linux-3.2-fast/drivers/md/dm-crypt.c =================================================================== --- linux-3.2-fast.orig/drivers/md/dm-crypt.c 2012-02-18 17:11:40.000000000 +0100 +++ linux-3.2-fast/drivers/md/dm-crypt.c 2012-02-18 17:12:12.000000000 +0100 @@ -827,16 +827,16 @@ static void crypt_dec_cc_pending(struct /* * Encrypt / decrypt data from one bio to another one (can be the same one) */ -static int crypt_convert(struct crypt_config *cc, - struct dm_crypt_io *io) +static void crypt_convert(struct crypt_config *cc, + struct dm_crypt_io *io) { - int r; LIST_HEAD(batch); unsigned batch_count = 0; atomic_set(&io->cc_pending, 1); while (1) { + int r; struct ablkcipher_request *req = crypt_alloc_req(cc, io, GFP_NOWAIT); if (!req) { /* @@ -851,8 +851,9 @@ static int crypt_convert(struct crypt_co r = crypt_convert_block(cc, io, req, &batch); if (unlikely(r < 0)) { crypt_flush_batch(cc, &batch); + io->error = -EIO; crypt_dec_cc_pending(io); - goto ret; + return; } io->cc_sector++; @@ -868,12 +869,8 @@ static int crypt_convert(struct crypt_co } break; } - r = 0; crypt_flush_batch(cc, &batch); -ret: - - return r; } static void dm_crypt_bio_destructor(struct bio *bio) @@ -1136,7 +1133,6 @@ static void kcryptd_crypt_write_convert( struct bio *clone; unsigned remaining = io->base_bio->bi_size; sector_t sector = io->sector; - int r; /* * Prevent io from disappearing until this function completes. @@ -1157,9 +1153,7 @@ static void kcryptd_crypt_write_convert( sector += bio_sectors(clone); crypt_inc_pending(io); - r = crypt_convert(cc, io); - if (r) - io->error = -EIO; + crypt_convert(cc, io); dec: crypt_dec_pending(io); @@ -1168,17 +1162,13 @@ dec: static void kcryptd_crypt_read_convert(struct dm_crypt_io *io) { struct crypt_config *cc = io->cc; - int r = 0; crypt_inc_pending(io); crypt_convert_init(cc, io, io->base_bio, io->base_bio, io->sector); - r = crypt_convert(cc, io); - - if (r < 0) - io->error = -EIO; + crypt_convert(cc, io); crypt_dec_pending(io); }