From: Sakari Ailus Date: Wed, 27 May 2020 08:35:01 +0000 (+0200) Subject: media: ccs: Stop reading arrays after the first zero X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=6a0970986e425f5750b081542c340c855d8890e5;p=linux.git media: ccs: Stop reading arrays after the first zero The register arrays have a certain size but not all the entries will be relevant. In practice reading can be stopped after encountering a zero value in the array. Do that to avoid extra reads. Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c index be27b002a7728..dec248fe7cc12 100644 --- a/drivers/media/i2c/ccs/ccs-core.c +++ b/drivers/media/i2c/ccs/ccs-core.c @@ -199,6 +199,9 @@ static int ccs_read_all_limits(struct ccs_sensor *sensor) goto out_err; } + if (!val && j) + break; + ccs_assign_limit(ptr, width, val); dev_dbg(&client->dev, "0x%8.8x \"%s\" = %u, 0x%x\n",