diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index bb11a95..6f18838 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -825,16 +825,16 @@ static void crypt_dec_cc_pending(struct dm_crypt_io *io)
/*
* 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) {
/*
@@ -849,8 +849,9 @@ static int crypt_convert(struct crypt_config *cc,
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->sector++;
@@ -866,12 +867,8 @@ static int crypt_convert(struct crypt_config *cc,
}
break;
}
- r = 0;