From 8ffdfe3af21dc423f0cda33bdda07aac74e870a2 Mon Sep 17 00:00:00 2001 From: Clark Wang <xiaoning.wang@nxp.com> Date: Fri, 11 Jan 2019 16:43:34 +0800 Subject: [PATCH] MLK-20234 isl29023: fix Coverity warning Fix the Coverity warning "divide_by_zero". If "rext" is incorrectly set as zero in dts file, "divide_by_zero" will happen at line 960. So add a judgment condition here, and let "rext" uses default value when it is equal to zero. Signed-off-by: Clark Wang <xiaoning.wang@nxp.com> (cherry picked from commit 999f94e0d7524640381eb4b3f6590f213533679e) --- drivers/input/misc/isl29023.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/misc/isl29023.c b/drivers/input/misc/isl29023.c index ebe8d3a304d11d..851a0fa177b6ba 100644 --- a/drivers/input/misc/isl29023.c +++ b/drivers/input/misc/isl29023.c @@ -916,7 +916,7 @@ static int isl29023_probe(struct i2c_client *client, } err = of_property_read_u32(of_node, "rext", &rext); - if (err) + if (err || rext == 0) rext = DEFAULT_REGISTOR_VAL; shared_irq = of_property_read_bool(of_node, "shared-interrupt"); -- GitLab