MLK-20368 i2c-imx: Coverity: fix divide by zero warning
authorClark Wang <xiaoning.wang@nxp.com>
Tue, 15 Jan 2019 02:04:30 +0000 (10:04 +0800)
committerLeonard Crestez <leonard.crestez@nxp.com>
Thu, 2 May 2019 08:35:29 +0000 (11:35 +0300)
commit456caa9ba270ca8f4f962918a0625d1a8348f316
treee580ec03703548a21584d698268dcecbfdc3d923
parentd6dbb4df467708af2d5fc8bb59f961a8add5cdc2
MLK-20368 i2c-imx: Coverity: fix divide by zero warning

"i2c_clk_rate / 2" might be zero when the i2c_clk_rate gets the clock is
0 or 1, so add a judgment to avoid the denominator is equal to 0.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
[Arul: Add support to check return value everywhere in the driver]
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Shrikant Bobade <Shrikant_Bobade@mentor.com>
(cherry picked from commit d382de595bffc0975ab7c0582e08dd4f7afc0c1a)
drivers/i2c/busses/i2c-imx.c