Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ab8500_btemp: Fix error return code

Initialize return variable before exiting on an error path.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != &ret
*if(...)
{
... when != ret = e2
when forall
return ret;
}

// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>

authored by

Julia Lawall and committed by
Anton Vorontsov
05cdbdb9 588d4f0b

+1
+1
drivers/power/ab8500_btemp.c
··· 1014 1014 create_singlethread_workqueue("ab8500_btemp_wq"); 1015 1015 if (di->btemp_wq == NULL) { 1016 1016 dev_err(di->dev, "failed to create work queue\n"); 1017 + ret = -ENOMEM; 1017 1018 goto free_device_info; 1018 1019 } 1019 1020