ALSA: sound/atmel/abdac.c: fix error return code
authorJulia Lawall <Julia.Lawall@lip6.fr>
Sun, 19 Aug 2012 07:02:58 +0000 (09:02 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 20 Aug 2012 08:53:13 +0000 (10:53 +0200)
Initialize retval before returning from a failed call to 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/abdac.c

index 98554f4882b7d0738e107b4ab55070fbb285871a..277ebce23a452be6cb027590eb997c278971eba8 100644 (file)
@@ -452,6 +452,7 @@ static int __devinit atmel_abdac_probe(struct platform_device *pdev)
        dac->regs = ioremap(regs->start, resource_size(regs));
        if (!dac->regs) {
                dev_dbg(&pdev->dev, "could not remap register memory\n");
+               retval = -ENOMEM;
                goto out_free_card;
        }