AnsweredAssumed Answered

I2C error handling BUG? on adau1701.c

Question asked by sofy Employee on Aug 3, 2017
Latest reply on Aug 3, 2017 by sofy
Always fail to load program by I2C to ADAU1701. And Customer found something wrong error handling on adau1701.c

About adau1701.c line 349 code as below

ret = sigmadsp_setup(adau1701->sigmadsp, rate);
if (ret) {               dev_warn(codec->dev, "Failed to load firmware\n");               return ret;          }
above code check "ret" value. But even success to load, ret is not TRUE. 
Bause "ret" is set "#bytes" on i2c-core-base.c when success to load.
So the customer fix
Is it OK?

"ret" is set at below code line 1961 on i2c-core-base.c\i2c\drivers - kernel/git/torvalds/linux.git - Linux kernel source tree 

int i2c_master_send(const struct i2c_client *client, const char *buf, int count){     int ret;     struct i2c_adapter *adap = client->adapter;     struct i2c_msg msg;      msg.addr = client->addr;     msg.flags = client->flags & I2C_M_TEN;     msg.len = count;     msg.buf = (char *)buf;      ret = i2c_transfer(adap, &msg, 1);      /*      * If everything went ok (i.e. 1 msg transmitted), return #bytes      * transmitted, else error code.      */     return (ret == 1) ? count : ret;}
Thank you for your help as always.
Best regards,