Commit f0d39a17 authored by Rui Miguel Silva's avatar Rui Miguel Silva Committed by Greg Kroah-Hartman

staging: typec: fusb302: reset i2c_busy state in error

Fix reset of i2c_busy flag if an error occurs during the i2c block read.
Signed-off-by: default avatarRui Miguel Silva <rmfrfs@gmail.com>
Acked-by: default avatarYueyao Zhu <yueyao.zhu@gmail.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ca6e8cdb
...@@ -365,13 +365,15 @@ static int fusb302_i2c_block_read(struct fusb302_chip *chip, u8 address, ...@@ -365,13 +365,15 @@ static int fusb302_i2c_block_read(struct fusb302_chip *chip, u8 address,
if (ret < 0) { if (ret < 0) {
fusb302_log(chip, "cannot block read 0x%02x, len=%d, ret=%d", fusb302_log(chip, "cannot block read 0x%02x, len=%d, ret=%d",
address, length, ret); address, length, ret);
return ret; goto done;
} }
if (ret != length) { if (ret != length) {
fusb302_log(chip, "only read %d/%d bytes from 0x%02x", fusb302_log(chip, "only read %d/%d bytes from 0x%02x",
ret, length, address); ret, length, address);
return -EIO; ret = -EIO;
} }
done:
atomic_set(&chip->i2c_busy, 0); atomic_set(&chip->i2c_busy, 0);
return ret; return ret;
......
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