[PATCH v3 2/3] staging: typec: fusb302: reset i2c_busy state in error
Guenter Roeck
linux at roeck-us.net
Mon May 15 13:31:08 UTC 2017
On 05/12/2017 01:16 PM, Rui Miguel Silva wrote:
> Fix reset of i2c_busy flag if an error occurs during the i2c block read.
>
> Signed-off-by: Rui Miguel Silva <rmfrfs at gmail.com>
Reviewed-by: Guenter Roeck <linux at roeck-us.net>
> ---
> drivers/staging/typec/fusb302/fusb302.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/typec/fusb302/fusb302.c b/drivers/staging/typec/fusb302/fusb302.c
> index 65df6407db84..37fd0bd0f2a6 100644
> --- a/drivers/staging/typec/fusb302/fusb302.c
> +++ b/drivers/staging/typec/fusb302/fusb302.c
> @@ -365,13 +365,15 @@ static int fusb302_i2c_block_read(struct fusb302_chip *chip, u8 address,
> if (ret < 0) {
> fusb302_log(chip, "cannot block read 0x%02x, len=%d, ret=%d",
> address, length, ret);
> - return ret;
> + goto done;
> }
> if (ret != length) {
> fusb302_log(chip, "only read %d/%d bytes from 0x%02x",
> ret, length, address);
> - return -EIO;
> + ret = -EIO;
> }
> +
> +done:
> atomic_set(&chip->i2c_busy, 0);
>
> return ret;
>
More information about the devel
mailing list