
From: "Antonino A. Daplas" <adaplas@hotpop.com>

Fixed error handling in rivafb-i2c.c if bus registration fails.

Signed-off-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/drivers/video/nvidia/nv_i2c.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletion(-)

diff -puN drivers/video/nvidia/nv_i2c.c~nvidiafb-fix-i2c-error-handling drivers/video/nvidia/nv_i2c.c
--- 25/drivers/video/nvidia/nv_i2c.c~nvidiafb-fix-i2c-error-handling	Sun Mar  6 17:18:06 2005
+++ 25-akpm/drivers/video/nvidia/nv_i2c.c	Sun Mar  6 17:18:06 2005
@@ -119,9 +119,12 @@ static int nvidia_setup_i2c_bus(struct n
 	if (rc == 0)
 		dev_dbg(&chan->par->pci_dev->dev,
 			"I2C bus %s registered.\n", name);
-	else
+	else {
 		dev_warn(&chan->par->pci_dev->dev,
 			 "Failed to register I2C bus %s.\n", name);
+		chan->par = NULL;
+	}
+
 	return rc;
 }
 
@@ -175,6 +178,9 @@ static u8 *nvidia_do_probe_i2c_edid(stru
 	};
 	u8 *buf;
 
+	if (!chan->par)
+		return NULL;
+
 	buf = kmalloc(EDID_LENGTH, GFP_KERNEL);
 	if (!buf) {
 		dev_warn(&chan->par->pci_dev->dev, "Out of memory!\n");
_
