
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/riva/rivafb-i2c.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff -puN drivers/video/riva/rivafb-i2c.c~rivafb-fix-i2c-error-handling drivers/video/riva/rivafb-i2c.c
--- 25/drivers/video/riva/rivafb-i2c.c~rivafb-fix-i2c-error-handling	Sun Mar  6 17:18:05 2005
+++ 25-akpm/drivers/video/riva/rivafb-i2c.c	Sun Mar  6 17:18:05 2005
@@ -120,8 +120,12 @@ static int riva_setup_i2c_bus(struct riv
 	rc = i2c_bit_add_bus(&chan->adapter);
 	if (rc == 0)
 		dev_dbg(&chan->par->pdev->dev, "I2C bus %s registered.\n", name);
-	else
-		dev_warn(&chan->par->pdev->dev, "Failed to register I2C bus %s.\n", name);
+	else {
+		dev_warn(&chan->par->pdev->dev,
+			 "Failed to register I2C bus %s.\n", name);
+		chan->par = NULL;
+	}
+
 	return rc;
 }
 
@@ -172,6 +176,9 @@ static u8 *riva_do_probe_i2c_edid(struct
 	};
 	u8 *buf;
 
+	if (!chan->par)
+		return NULL;
+
 	buf = kmalloc(EDID_LENGTH, GFP_KERNEL);
 	if (!buf) {
 		dev_warn(&chan->par->pdev->dev, "Out of memory!\n");
_
