]> rtime.felk.cvut.cz Git - linux-imx.git/commit
ASoC: ux500_msp_i2s: better use devm functions and fix error return code
authorJulia Lawall <Julia.Lawall@lip6.fr>
Sun, 19 Aug 2012 07:02:53 +0000 (09:02 +0200)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 20 Aug 2012 19:44:28 +0000 (20:44 +0100)
commitb18e93a493626c1446f9788ebd5844d008bbf71c
treeb65825976f6e63b8a4a47c38dc875f1e7d623143
parentdb8b624d55e65ad5d8211a9fef66fa7f16bd13a0
ASoC: ux500_msp_i2s: better use devm functions and fix error return code

Remove unnecessary calls to devm_kfree and replace iounmap by devm_iounmap
(and use resource_size for the third argument).  These changes make it
possible to remove the error-handling code at the end of
ux500_msp_i2s_init_msp, and all of the gotos become direct returns.

In the case of the second call to devm_kzalloc, the return variable ret was
not initialized.  Here it is changed to a direct return of -ENOMEM.

A simplified version of the semantic match that finds the second 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: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/ux500/ux500_msp_i2s.c