aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@lip6.fr>2012-08-19 03:02:57 -0400
committerTakashi Iwai <tiwai@suse.de>2012-08-20 04:56:01 -0400
commit0c23e46eb4878422c25351ff54ab0fe80c643809 (patch)
treec65f5098ef603acc9b18c08dbcb7b381d50374ca
parentaaf265c22e48f10c94ad04d23b6ab0c88f554d35 (diff)
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>
-rw-r--r--sound/atmel/ac97c.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c
index 3c8d3ba7ddfc..9052aff37f64 100644
--- a/sound/atmel/ac97c.c
+++ b/sound/atmel/ac97c.c
@@ -278,14 +278,9 @@ static int atmel_ac97c_capture_hw_params(struct snd_pcm_substream *substream,
278 if (retval < 0) 278 if (retval < 0)
279 return retval; 279 return retval;
280 /* snd_pcm_lib_malloc_pages returns 1 if buffer is changed. */ 280 /* snd_pcm_lib_malloc_pages returns 1 if buffer is changed. */
281 if (cpu_is_at32ap7000()) { 281 if (cpu_is_at32ap7000() && retval == 1)
282 if (retval < 0) 282 if (test_and_clear_bit(DMA_RX_READY, &chip->flags))
283 return retval; 283 dw_dma_cyclic_free(chip->dma.rx_chan);
284 /* snd_pcm_lib_malloc_pages returns 1 if buffer is changed. */
285 if (retval == 1)
286 if (test_and_clear_bit(DMA_RX_READY, &chip->flags))
287 dw_dma_cyclic_free(chip->dma.rx_chan);
288 }
289 284
290 /* Set restrictions to params. */ 285 /* Set restrictions to params. */
291 mutex_lock(&opened_mutex); 286 mutex_lock(&opened_mutex);
@@ -980,6 +975,7 @@ static int __devinit atmel_ac97c_probe(struct platform_device *pdev)
980 975
981 if (!chip->regs) { 976 if (!chip->regs) {
982 dev_dbg(&pdev->dev, "could not remap register memory\n"); 977 dev_dbg(&pdev->dev, "could not remap register memory\n");
978 retval = -ENOMEM;
983 goto err_ioremap; 979 goto err_ioremap;
984 } 980 }
985 981