Commit 71992da3 authored by Antonino Daplas's avatar Antonino Daplas Committed by Linus Torvalds

[PATCH] nvidiafb: Fix i2c error handling

Fixed error handling in rivafb-i2c.c if bus registration fails.
Signed-off-by: default avatarAntonino Daplas <adaplas@pol.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 71b2cdc4
...@@ -119,9 +119,12 @@ static int nvidia_setup_i2c_bus(struct nvidia_i2c_chan *chan, const char *name) ...@@ -119,9 +119,12 @@ static int nvidia_setup_i2c_bus(struct nvidia_i2c_chan *chan, const char *name)
if (rc == 0) if (rc == 0)
dev_dbg(&chan->par->pci_dev->dev, dev_dbg(&chan->par->pci_dev->dev,
"I2C bus %s registered.\n", name); "I2C bus %s registered.\n", name);
else else {
dev_warn(&chan->par->pci_dev->dev, dev_warn(&chan->par->pci_dev->dev,
"Failed to register I2C bus %s.\n", name); "Failed to register I2C bus %s.\n", name);
chan->par = NULL;
}
return rc; return rc;
} }
...@@ -175,6 +178,9 @@ static u8 *nvidia_do_probe_i2c_edid(struct nvidia_i2c_chan *chan) ...@@ -175,6 +178,9 @@ static u8 *nvidia_do_probe_i2c_edid(struct nvidia_i2c_chan *chan)
}; };
u8 *buf; u8 *buf;
if (!chan->par)
return NULL;
buf = kmalloc(EDID_LENGTH, GFP_KERNEL); buf = kmalloc(EDID_LENGTH, GFP_KERNEL);
if (!buf) { if (!buf) {
dev_warn(&chan->par->pci_dev->dev, "Out of memory!\n"); dev_warn(&chan->par->pci_dev->dev, "Out of memory!\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment