Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3e39752d authored by Tony Lindgren's avatar Tony Lindgren Committed by Jean Delvare
Browse files

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: default avatarTony Lindgren <tony@atomide.com>
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
parent 1a1b285c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;