]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
Fix bug #9581: Dereferencing NULL pointer for omap I2C
authorTony Lindgren <tony@atomide.com>
Sun, 16 Dec 2007 18:17:01 +0000 (10:17 -0800)
committerTony Lindgren <tony@atomide.com>
Sun, 16 Dec 2007 18:17:01 +0000 (10:17 -0800)
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>
drivers/i2c/busses/i2c-omap.c

index b3a48a8a908cf16b5306a0a7b92039cfc1415aa7..d7958b8354b4bf3c95f6eb45de0bba6f3f5c1d6c 100644 (file)
@@ -788,13 +788,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;