alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: srinivas.kandagatla@linaro.org
Cc: alsa-devel@alsa-project.org
Subject: Re: ASoC: qcom: add mic support
Date: Fri, 25 Mar 2016 12:00:02 +0300	[thread overview]
Message-ID: <20160325090002.GA10634@mwanda> (raw)

Hello Srinivas Kandagatla,

The patch fb5d11524eda: "ASoC: qcom: add mic support" from Feb 11,
2016, leads to the following static checker warning:

	sound/soc/qcom/lpass-platform.c:555 lpass_platform_pcm_new()
	error: uninitialized symbol 'ret'.

sound/soc/qcom/lpass-platform.c
   515          csubstream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
   516          if (csubstream) {
   517                  if (v->alloc_dma_channel)
   518                          data->wrdma_ch = v->alloc_dma_channel(drvdata,
   519                                                  SNDRV_PCM_STREAM_CAPTURE);
   520  
   521                  if (IS_ERR_VALUE(data->wrdma_ch))
   522                          goto capture_alloc_err;

->wrdma_ch is an int so this should just be:

			if (data->wrdma_ch < 0) {
				ret = data->wrdma_ch;
				goto capture_alloc_err;
			}

The other ->alloc_dma_channel uses the same IS_ERR_VALUE() check as well
so we should probably clean that up as well.  The IS_ERR_VALUE()
function is for places which return unsigned long basically.  No need to
be fancy for normal "negative returns are error" code.

   523  
   524                  drvdata->substream[data->wrdma_ch] = csubstream;
   525  
   526                  ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
   527                                          soc_runtime->platform->dev,
   528                                          size, &csubstream->dma_buffer);
   529                  if (ret)
   530                          goto capture_alloc_err;
   531  
   532                  ret = regmap_write(drvdata->lpaif_map,
   533                          LPAIF_WRDMACTL_REG(v, data->wrdma_ch), 0);
   534                  if (ret) {
   535                          dev_err(soc_runtime->dev,
   536                                  "%s() error writing to wrdmactl reg: %d\n",
   537                                  __func__, ret);
   538                          goto capture_reg_err;
   539                  }
   540          }
   541  
   542          return 0;
   543  
   544  capture_reg_err:
   545          if (csubstream)
   546                  snd_dma_free_pages(&csubstream->dma_buffer);
   547  
   548  capture_alloc_err:
   549          if (psubstream)
   550                  snd_dma_free_pages(&psubstream->dma_buffer);
   551  
   552   playback_alloc_err:
   553          dev_err(soc_runtime->dev, "Cannot allocate buffer(s)\n");
   554  
   555          return ret;
   556  }

regards,
dan carpenter

                 reply	other threads:[~2016-03-25  9:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160325090002.GA10634@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=srinivas.kandagatla@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).