From: Milan Broz <mbroz@redhat.com>

Simplify crypt_endio function.

Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
---
 drivers/md/dm-crypt.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

Index: linux-2.6.24/drivers/md/dm-crypt.c
===================================================================
--- linux-2.6.24.orig/drivers/md/dm-crypt.c	2008-02-07 13:48:28.000000000 +0000
+++ linux-2.6.24/drivers/md/dm-crypt.c	2008-02-07 13:48:29.000000000 +0000
@@ -504,7 +504,7 @@ static void crypt_endio(struct bio *clon
 {
 	struct dm_crypt_io *io = clone->bi_private;
 	struct crypt_config *cc = io->target->private;
-	unsigned read_io = bio_data_dir(clone) == READ;
+	unsigned rw = bio_data_dir(clone);
 
 	if (unlikely(!bio_flagged(clone, BIO_UPTODATE) && !error))
 		error = -EIO;
@@ -512,20 +512,15 @@ static void crypt_endio(struct bio *clon
 	/*
 	 * free the processed pages
 	 */
-	if (!read_io) {
+	if (rw == WRITE)
 		crypt_free_buffer_pages(cc, clone);
-		goto out;
-	}
-
-	if (unlikely(error))
-		goto out;
 
 	bio_put(clone);
-	kcryptd_queue_crypt(io);
-	return;
 
-out:
-	bio_put(clone);
+	if (rw == READ && !error) {
+		kcryptd_queue_crypt(io);
+		return;
+	}
 
 	if (unlikely(error))
 		io->error = error;
