|
@@ -167,6 +167,9 @@ static int pca954x_reg_write(struct i2c_adapter *adap,
|
|
|
buf[0] = val;
|
|
|
msg.buf = buf;
|
|
|
ret = __i2c_transfer(adap, &msg, 1);
|
|
|
+
|
|
|
+ if (ret >= 0 && ret != 1)
|
|
|
+ ret = -EREMOTEIO;
|
|
|
} else {
|
|
|
union i2c_smbus_data data;
|
|
|
ret = adap->algo->smbus_xfer(adap, client->addr,
|
|
@@ -195,7 +198,7 @@ static int pca954x_select_chan(struct i2c_mux_core *muxc, u32 chan)
|
|
|
/* Only select the channel if its different from the last channel */
|
|
|
if (data->last_chan != regval) {
|
|
|
ret = pca954x_reg_write(muxc->parent, client, regval);
|
|
|
- data->last_chan = ret ? 0 : regval;
|
|
|
+ data->last_chan = ret < 0 ? 0 : regval;
|
|
|
}
|
|
|
|
|
|
return ret;
|