]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: sound/atmel/ac97c.c: fix error return code
authorJulia Lawall <Julia.Lawall@lip6.fr>
Sun, 19 Aug 2012 07:02:57 +0000 (09:02 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 20 Aug 2012 08:56:01 +0000 (10:56 +0200)
commit5f57e741a0ad75801d8f4f68b960380b3481864a
treec65f5098ef603acc9b18c08dbcb7b381d50374ca
parent834b4756af61ee914895cd6241a7f31961ef8efb
ALSA: sound/atmel/ac97c.c: fix error return code

In the first case, the second test of whether retval is negative is
redundant.  It is dropped and the previous and subsequent tests are
combined.

In the second case, add an initialization of retval on failure of ioremap.

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: Takashi Iwai <tiwai@suse.de>
sound/atmel/ac97c.c