Hi,
On 14-08-17 22:35, Andy Shevchenko wrote:
On Mon, 2017-08-14 at 22:17 +0200, Hans de Goede wrote:
Although unlikely without locking the smbux_xfer function may miss
the nack flag and further fixes in this patch-set add some more
complex constructions which need protection.
- if (read_write == I2C_SMBUS_READ) {
+ ret = 0;
+ mutex_lock(&adap->adap_lock);
+ if (adap->nack)
+ ret = -EIO;
+ else if (read_write == I2C_SMBUS_READ) {
ret = regmap_read(adap->regmap, CHT_WC_I2C_RDDATA,
®);
- if (ret)
- return ret;
-
data->byte = reg;
Can this be moved out to keep logic the same (don't dirt data on error)?
Setting data on error is not really a problem and this gets
fixed in the next patch in the series where the reading
of the data moves to the irq-handler.
Regards,
Hans