]> git.baikalelectronics.ru Git - kernel.git/commit
media: imx274: don't randomly return if range_count is zero
authorMauro Carvalho Chehab <mchehab@s-opensource.com>
Wed, 1 Nov 2017 21:05:57 +0000 (17:05 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Mon, 11 Dec 2017 18:04:53 +0000 (13:04 -0500)
commit09082b35e22d113a795ed18f4112f8034957c017
tree09e59f7b03ba59be6c38b9eae77739bbaa5fa674
parenta879eb59052439ecfda43a79aa996912f6ef7254
media: imx274: don't randomly return if range_count is zero

As smatch reported:
drivers/media/i2c/imx274.c:659 imx274_regmap_util_write_table_8() error: uninitialized symbol 'err'.

There is a bug at imx274_regmap_util_write_table_8() with causes
it to randomly return a random error if range_count is zero.

Worse than that, the logic there starts with range_count
equal to zero, and periodically resets it to zero again.

As it is a way more likely that err assumes a non-zero value,
I suspect that the chance of this code to run is very small,
so, it would be worth to review the entire function.

Anyway, clearly it shouldn't be returning error if range_count
is zero. So, let's fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/i2c/imx274.c