Commit 2e743787 authored by Troy Kisky's avatar Troy Kisky Committed by Jean Delvare

i2c-davinci: Initialize cmd_complete sooner

If an interrupt happens before an I2c master read/write,
complete is called on uninitialized structure.
Signed-off-by: default avatarTroy Kisky <troy.kisky@boundarydevices.com>
Signed-off-by: default avatarKevin Hilman <khilman@mvista.com>
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
parent 5a0d5f5f
...@@ -262,7 +262,7 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop) ...@@ -262,7 +262,7 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
davinci_i2c_write_reg(dev, DAVINCI_I2C_CNT_REG, dev->buf_len); davinci_i2c_write_reg(dev, DAVINCI_I2C_CNT_REG, dev->buf_len);
init_completion(&dev->cmd_complete); INIT_COMPLETION(dev->cmd_complete);
dev->cmd_err = 0; dev->cmd_err = 0;
/* Take I2C out of reset, configure it as master and set the /* Take I2C out of reset, configure it as master and set the
...@@ -519,6 +519,7 @@ static int davinci_i2c_probe(struct platform_device *pdev) ...@@ -519,6 +519,7 @@ static int davinci_i2c_probe(struct platform_device *pdev)
goto err_release_region; goto err_release_region;
} }
init_completion(&dev->cmd_complete);
dev->dev = get_device(&pdev->dev); dev->dev = get_device(&pdev->dev);
dev->irq = irq->start; dev->irq = irq->start;
platform_set_drvdata(pdev, dev); platform_set_drvdata(pdev, dev);
......
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