From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753050AbbDEMNq (ORCPT ); Sun, 5 Apr 2015 08:13:46 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:46675 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753013AbbDEMNm (ORCPT ); Sun, 5 Apr 2015 08:13:42 -0400 X-IronPort-AV: E=Sophos;i="5.11,527,1422918000"; d="scan'208";a="108405173" Date: Sun, 5 Apr 2015 14:13:39 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@localhost6.localdomain6 To: Julia Lawall cc: Jaroslav Kysela , kernel-janitors@vger.kernel.org, Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 5/9] sound/atmel/ac97c.c: fix error return code In-Reply-To: <1428233914-4503-7-git-send-email-Julia.Lawall@lip6.fr> Message-ID: References: <1428233914-4503-1-git-send-email-Julia.Lawall@lip6.fr> <1428233914-4503-7-git-send-email-Julia.Lawall@lip6.fr> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Please ignore. Wrong patch set. On Sun, 5 Apr 2015, Julia Lawall wrote: > From: Julia Lawall > > 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/) > > // > ( > if@p1 (\(ret < 0\|ret != 0\)) > { ... return ret; } > | > ret@p1 = 0 > ) > ... when != ret = e1 > when != &ret > *if(...) > { > ... when != ret = e2 > when forall > return ret; > } > > // > > Signed-off-by: Julia Lawall > > --- > sound/atmel/ac97c.c | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) > > diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c > index 3c8d3ba..9052aff 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, > if (retval < 0) > return retval; > /* snd_pcm_lib_malloc_pages returns 1 if buffer is changed. */ > - if (cpu_is_at32ap7000()) { > - if (retval < 0) > - return retval; > - /* snd_pcm_lib_malloc_pages returns 1 if buffer is changed. */ > - if (retval == 1) > - if (test_and_clear_bit(DMA_RX_READY, &chip->flags)) > - dw_dma_cyclic_free(chip->dma.rx_chan); > - } > + if (cpu_is_at32ap7000() && retval == 1) > + if (test_and_clear_bit(DMA_RX_READY, &chip->flags)) > + dw_dma_cyclic_free(chip->dma.rx_chan); > > /* Set restrictions to params. */ > mutex_lock(&opened_mutex); > @@ -980,6 +975,7 @@ static int __devinit atmel_ac97c_probe(struct platform_device *pdev) > > if (!chip->regs) { > dev_dbg(&pdev->dev, "could not remap register memory\n"); > + retval = -ENOMEM; > goto err_ioremap; > } > > > -- > To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >