Hi Baruch,

On 2018年01月10日 00:54, Baruch Siach wrote:
Hi Shunqian Zheng,

On Tue, Jan 09, 2018 at 10:48:21PM +0800, Shunqian Zheng wrote:
+static int ov5695_write_array(struct i2c_client *client,
+                             const struct regval *regs)
+{
+       u32 i;
+       int ret = 0;
+
+       for (i = 0; ret == 0 && regs[i].addr != REG_NULL; i++)
+               ret = ov5695_write_reg(client, regs[i].addr,
+                                      OV5695_REG_VALUE_08BIT, regs[i].val);
This loop should stop on first failure, and return the error value. With
current code a register write failure is masked by following writes.
This loop will stop once ret != 0 as in for loop condition

Thanks,

+
+       return ret;
+}
baruch



Reply via email to