i2c-omap: Fix NULL pointer dereferencing

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Monday, January 14, 2008 - 2:59 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3e3975...
Commit:     3e39752d5367f9087e058abe768708165e1ec373
Parent:     1a1b285c24e1468afe82b09330dde5192a6e0013
Author:     Tony Lindgren <tony@atomide.com>
AuthorDate: Mon Jan 14 21:53:30 2008 +0100
Committer:  Jean Delvare <khali@hyperion.delvare>
CommitDate: Mon Jan 14 21:53:30 2008 +0100

    i2c-omap: Fix NULL pointer dereferencing
    
    This patch fixes bug #9581 reported by Marcio Buss. If kzalloc fails,
    omap_i2c_write_reg() tries to reset an unallocated I2C controller.
    
    Cc: Marcio Buss <marciobuss@gmail.com>
    Signed-off-by: Tony Lindgren <tony@atomide.com>
    Signed-off-by: Jean Delvare <khali@linux-fr.org>
---
 drivers/i2c/busses/i2c-omap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index cb55cf2..f2552b1 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -619,13 +619,13 @@ omap_i2c_probe(struct platform_device *pdev)
 err_free_irq:
 	free_irq(dev->irq, dev);
 err_unuse_clocks:
+	omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
 	omap_i2c_disable_clocks(dev);
 	omap_i2c_put_clocks(dev);
 err_free_mem:
 	platform_set_drvdata(pdev, NULL);
 	kfree(dev);
 err_release_region:
-	omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
 	release_mem_region(mem->start, (mem->end - mem->start) + 1);
 
 	return r;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
i2c-omap: Fix NULL pointer dereferencing, Linux Kernel Mailing ..., (Mon Jan 14, 2:59 pm)