From f7ef12482b17a015906cf74afe655e691b5fa2cb Mon Sep 17 00:00:00 2001
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Date: Fri, 27 Mar 2009 12:46:32 +0100
Subject: icside: icside_dma_setup() fixes

Check for ide_build_sglist() return value and re-map sg table if necessary.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/icside.c | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'drivers/ide/icside.c')

diff --git a/drivers/ide/icside.c b/drivers/ide/icside.c
index 0cf47e6e979..cf0522f937c 100644
--- a/drivers/ide/icside.c
+++ b/drivers/ide/icside.c
@@ -326,6 +326,10 @@ static int icside_dma_setup(ide_drive_t *drive)
 	BUG_ON(dma_channel_active(ec->dma));
 
 	hwif->sg_nents = ide_build_sglist(drive, rq);
+	if (hwif->sg_nents == 0) {
+		ide_map_sg(drive, rq);
+		return 1;
+	}
 
 	/*
 	 * Ensure that we have the right interrupt routed.
-- 
cgit v1.2.3-18-g5258