IB/qib: Fix error return code in qib_init_7322_variables()
authorJulia Lawall <Julia.Lawall@lip6.fr>
Tue, 14 Aug 2012 12:58:35 +0000 (12:58 +0000)
committerRoland Dreier <roland@purestorage.com>
Wed, 15 Aug 2012 18:58:21 +0000 (11:58 -0700)
commit51fa3ca37e3bebb291dbe50faa3cb259af35e978
treec02b24de81fcf80dffc5d02d2556706df42a684b
parent0d7614f09c1ebdbaa1599a5aba7593f147bf96ee
IB/qib: Fix error return code in qib_init_7322_variables()

Convert a 0 error return code to a negative one, as returned elsewhere
in the function.

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

// <smpl>
@@
identifier ret;
expression e,e1,e2,e3,e4,x;
@@

(
if (\(ret != 0\|ret < 0\) || ...) { ... return ...; }
|
ret = 0
)
... when != ret = e1
*x = \(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\|ioremap\|ioremap_nocache\|devm_ioremap\|devm_ioremap_nocache\)(...);
... when != x = e2
    when != ret = e3
*if (x == NULL || ...)
{
  ... when != ret = e4
*  return ret;
}
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/hw/qib/qib_iba7322.c