Subject: powerpc/pmac: Fixup regression in probe with no media bay

From: Benjamin Herrenschmidt <[email-masked]>
Date: Wed, 09 Dec 2009 17:05:32 +1100

A little thinko in my media bay rework breaks the old IDE driver on machines
with no bay. This fixes it.

Note: I haven't pushed my new -next out yet with my rework in, so I'll locally
fold that patch in the rework to avoid bisection breakage and push the result
into my -next branch

Ben.

Index: linux-work/drivers/ide/pmac.c
===================================================================
--- linux-work.orig/drivers/ide/pmac.c	2009-12-09 16:55:59.000000000 +1100
+++ linux-work/drivers/ide/pmac.c	2009-12-09 16:56:27.000000000 +1100
@@ -1078,7 +1078,8 @@ static int __devinit pmac_ide_setup_devi
 	sanitize_timings(pmif);
 
 	/* If we are on a media bay, wait for it to settle and lock it */
-	lock_media_bay(pmif->mdev->media_bay);
+	if (pmif->mdev)
+		lock_media_bay(pmif->mdev->media_bay);
 
 	host = ide_host_alloc(&d, hws, 1);
 	if (host == NULL) {
@@ -1115,7 +1116,8 @@ static int __devinit pmac_ide_setup_devi
 	if (rc)
 		pmif->hwif = NULL;
 
-	unlock_media_bay(pmif->mdev->media_bay);
+	if (pmif->mdev)
+		unlock_media_bay(pmif->mdev->media_bay);
 
  bail:
 	if (rc && host)