]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
drivers/net/wireless/ti/wlcore/main.c: eliminate possible double power off
authorJulia Lawall <Julia.Lawall@lip6.fr>
Sun, 21 Oct 2012 10:52:04 +0000 (12:52 +0200)
committerLuciano Coelho <luca@coelho.fi>
Fri, 16 Nov 2012 17:53:00 +0000 (19:53 +0200)
commit4fb4e0bee12d66a175e13ed5d956e61398c34e4e
tree7b65b401fa55d95da9dc0114b12dd1a45a15aba9
parentb8d9e572cb8794335fb4ba63ff962acaa3c4473b
drivers/net/wireless/ti/wlcore/main.c: eliminate possible double power off

The function wl12xx_set_power_on is only called twice, once in
wl12xx_chip_wakeup and once in wl12xx_get_hw_info.  On the failure of the
call in wl12xx_chip_wakeup, the containing function just returns, but on
the failure of the call in wl12xx_get_hw_info, the containing function
calls wl1271_power_off.  This does not seem necessary, because if
wl12xx_set_power_on has set the power on and then fails, it has already
turned the power off.

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

// <smpl>
@r@
identifier f,free,a;
parameter list[n] ps;
type T;
expression e;
@@

f(ps,T a,...) {
  ... when any
      when != a = e
  if(...) { ... free(a); ... return ...; }
  ... when any
}

@@
identifier r.f,r.free;
expression x,a;
expression list[r.n] xs;
@@

* x = f(xs,a,...);
  if (...) { ... free(a); ... return ...; }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Luciano Coelho <luca@coelho.fi>
drivers/net/wireless/ti/wlcore/main.c