]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
staging: typec: fusb302: reset i2c_busy state in error
authorRui Miguel Silva <rmfrfs@gmail.com>
Fri, 12 May 2017 20:16:14 +0000 (21:16 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 May 2017 12:23:31 +0000 (14:23 +0200)
Fix reset of i2c_busy flag if an error occurs during the i2c block read.

Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Acked-by: Yueyao Zhu <yueyao.zhu@gmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/typec/fusb302/fusb302.c

index 6bd602db11befd8e3ed6ab03a42d9dfe6ca6a9ea..7b0b9e51016d24aea93445a7defa10d3d1a81fbd 100644 (file)
@@ -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;