ret = rk808_i2c_read(rk808, reg, 1, &val);
DBG("reg read 0x%02x -> 0x%02x\n", (int)reg, (unsigned)val&0xff);
- if (ret < 0)
- return ret;
-
+ if (ret < 0){
+ mutex_unlock(&rk808->io_lock);
+ return ret;
+ }
mutex_unlock(&rk808->io_lock);
return val & 0xff;
ret = rk808_i2c_read(rk808, reg, 1, &tmp);
DBG("1 reg read 0x%02x -> 0x%02x\n", (int)reg, (unsigned)tmp&0xff);
- if (ret < 0)
- return ret;
+ if (ret < 0){
+ mutex_unlock(&rk808->io_lock);
+ return ret;
+ }
tmp = (tmp & ~mask) | val;
ret = rk808_i2c_write(rk808, reg, 1, tmp);
DBG("reg write 0x%02x -> 0x%02x\n", (int)reg, (unsigned)val&0xff);
- if (ret < 0)
- return ret;
-
+ if (ret < 0){
+ mutex_unlock(&rk808->io_lock);
+ return ret;
+ }
ret = rk808_i2c_read(rk808, reg, 1, &tmp);
- if (ret < 0)
- return ret;
+ if (ret < 0){
+ mutex_unlock(&rk808->io_lock);
+ return ret;
+ }
DBG("2 reg read 0x%02x -> 0x%02x\n", (int)reg, (unsigned)tmp&0xff);
mutex_unlock(&rk808->io_lock);
ret = syr82x_i2c_read(syr82x->i2c, reg, 1, &val);
DBG("reg read 0x%02x -> 0x%02x\n", (int)reg, (unsigned)val&0xff);
- if (ret < 0)
+ if (ret < 0){
+ mutex_unlock(&syr82x->io_lock);
return ret;
-
+ }
mutex_unlock(&syr82x->io_lock);
return val & 0xff;
ret = syr82x_i2c_read(syr82x->i2c, reg, 1, &tmp);
DBG("1 reg read 0x%02x -> 0x%02x\n", (int)reg, (unsigned)tmp&0xff);
- if (ret < 0)
- return ret;
+ if (ret < 0){
+ mutex_unlock(&syr82x->io_lock);
+ return ret;
+ }
tmp = (tmp & ~mask) | val;
ret = syr82x_i2c_write(syr82x->i2c, reg, 1, tmp);
DBG("reg write 0x%02x -> 0x%02x\n", (int)reg, (unsigned)val&0xff);
- if (ret < 0)
- return ret;
+ if (ret < 0){
+ mutex_unlock(&syr82x->io_lock);
+ return ret;
+ }
ret = syr82x_i2c_read(syr82x->i2c, reg, 1, &tmp);
DBG("2 reg read 0x%02x -> 0x%02x\n", (int)reg, (unsigned)tmp&0xff);
- if (ret < 0)
- return ret;
+ if (ret < 0){
+ mutex_unlock(&syr82x->io_lock);
+ return ret;
+ }
mutex_unlock(&syr82x->io_lock);
return 0;//ret;