It is unclear what the correct return value is when
master_xfer gets an error part way through a set of
messages, but other drivers seem to return the error
code of the individual failed message instead of
the number of successful messages. Convert the Tegra
i2c driver to do the same.
Change-Id: Iacda4b6d7591bfe644b93564b93356a0cda3134f
Signed-off-by: Colin Cross <ccross@android.com>
int stop = (i == (num - 1)) ? 1 : 0;
ret = tegra_i2c_xfer_msg(i2c_bus, &msgs[i], stop);
if (ret)
- break;
+ goto out;
}
+ ret = i;
+
+out:
clk_disable(i2c_dev->clk);
rt_mutex_unlock(&i2c_dev->dev_lock);
- return i;
+ return ret;
}
static u32 tegra_i2c_func(struct i2c_adapter *adap)