From 9ea244b4b545ecb323d042a0df5c080edefcd1fc Mon Sep 17 00:00:00 2001
From: "Loren M. Lang" <lorenl@alzatex.com>
Date: Fri, 3 Feb 2006 03:04:59 -0800
Subject: [PATCH] RocketPoint 1520 [hpt366] fails clock stabilization

I just purchased a HighPoint Rocket 1520 SATA controller.  There seems to
be no libata driver (yet), but there is an ide driver, hpt366.  When the
driver gets loaded, it causes a kernel NULL pointer dereference in
pci_bus_clock_list.  It seems to be because the driver is waiting for clock
stabilization in init_hpt37x() which never comes.  The driver just
continues on with the pci drvdata set to NULL, instead of a valid clock
entry.  The following patch prevents the NULL dereference from happening,
but instead exit with an error.

Acked-by: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
 drivers/ide/pci/hpt366.c | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'drivers/ide')

diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index 7b589d948bf..940bdd4c578 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -1288,6 +1288,10 @@ static void __devinit hpt37x_clocking(ide_hwif_t *hwif)
 				goto init_hpt37X_done;
 			}
 		}
+		if (!pci_get_drvdata(dev)) {
+			printk("No Clock Stabilization!!!\n");
+			return;
+		}
 pll_recal:
 		if (adjust & 1)
 			pll -= (adjust >> 1);
-- 
cgit