Re: [PATCH v2 2/3] staging: typec: fusb302: reset i2c_busy state in error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for the catch! With the fix, should the `done` label be added
before atomic_set(&chip->i2c_busy, 0); ?

On Fri, May 12, 2017 at 2:38 AM, Rui Miguel Silva <rmfrfs@xxxxxxxxx> wrote:
> Fix reset of i2c_busy flag if an error occurs during the i2c block read.
>
> Signed-off-by: Rui Miguel Silva <rmfrfs@xxxxxxxxx>
> ---
>  drivers/staging/typec/fusb302/fusb302.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/typec/fusb302/fusb302.c b/drivers/staging/typec/fusb302/fusb302.c
> index 65df6407db84..5e61937f01ab 100644
> --- a/drivers/staging/typec/fusb302/fusb302.c
> +++ b/drivers/staging/typec/fusb302/fusb302.c
> @@ -365,15 +365,16 @@ 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;
>         }

move done: label here?

>         atomic_set(&chip->i2c_busy, 0);
>
> +done:
>         return ret;
>  }
>
> --
> 2.12.2
>
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux