提交 f1c0b7e4 编写于 作者: B Brendan Higgins 提交者: Wolfram Sang

i2c: aspeed: fixed potential null pointer dereference

Before I skipped null checks when the master is in the STOP state; this
fixes that.
Signed-off-by: NBrendan Higgins <brendanhiggins@google.com>
Acked-by: NJoel Stanley <joel@jms.id.au>
Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
Fixes: f327c686 ("i2c: aspeed: added driver for Aspeed I2C")
上级 42543aeb
...@@ -410,10 +410,11 @@ static bool aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus) ...@@ -410,10 +410,11 @@ static bool aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus)
} }
/* We are in an invalid state; reset bus to a known state. */ /* We are in an invalid state; reset bus to a known state. */
if (!bus->msgs && bus->master_state != ASPEED_I2C_MASTER_STOP) { if (!bus->msgs) {
dev_err(bus->dev, "bus in unknown state"); dev_err(bus->dev, "bus in unknown state");
bus->cmd_err = -EIO; bus->cmd_err = -EIO;
aspeed_i2c_do_stop(bus); if (bus->master_state != ASPEED_I2C_MASTER_STOP)
aspeed_i2c_do_stop(bus);
goto out_no_complete; goto out_no_complete;
} }
msg = &bus->msgs[bus->msgs_index]; msg = &bus->msgs[bus->msgs_index];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册