diff mbox

ASoC: qcom: Fix some static checker warnings

Message ID 1459423312-6334-1-git-send-email-srinivas.kandagatla@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Srinivas Kandagatla March 31, 2016, 11:21 a.m. UTC
This patch fixes below static checker warning plus suggestions from Dan.

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;
			}

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/lpass-platform.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Mark Brown March 31, 2016, 5:31 p.m. UTC | #1
On Thu, Mar 31, 2016 at 12:21:52PM +0100, Srinivas Kandagatla wrote:
> This patch fixes below static checker warning plus suggestions from Dan.
> 
> sound/soc/qcom/lpass-platform.c:555 lpass_platform_pcm_new()
> error: uninitialized symbol 'ret'.

Please submit one patch per change, each with a clear changelog, as
covered in SubmittingPatches.  This makes it much easier to review
things since it's easier to tell if the patch does what it was intended
to do.
Srinivas Kandagatla March 31, 2016, 5:33 p.m. UTC | #2
On 31/03/16 18:31, Mark Brown wrote:
> On Thu, Mar 31, 2016 at 12:21:52PM +0100, Srinivas Kandagatla wrote:
>> This patch fixes below static checker warning plus suggestions from Dan.
>>
>> sound/soc/qcom/lpass-platform.c:555 lpass_platform_pcm_new()
>> error: uninitialized symbol 'ret'.
>
> Please submit one patch per change, each with a clear changelog, as
> covered in SubmittingPatches.  This makes it much easier to review
> things since it's easier to tell if the patch does what it was intended
> to do.

Thanks,
I will do that.

--srini

>
diff mbox

Patch

diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 6e86654..db000c6 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -474,7 +474,7 @@  static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime)
 	struct lpass_data *drvdata =
 		snd_soc_platform_get_drvdata(soc_runtime->platform);
 	struct lpass_variant *v = drvdata->variant;
-	int ret;
+	int ret = -EINVAL;
 	struct lpass_pcm_data *data;
 	size_t size = lpass_platform_pcm_hardware.buffer_bytes_max;
 
@@ -491,7 +491,7 @@  static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime)
 			data->rdma_ch = v->alloc_dma_channel(drvdata,
 						SNDRV_PCM_STREAM_PLAYBACK);
 
-		if (IS_ERR_VALUE(data->rdma_ch))
+		if (data->rdma_ch < 0)
 			return data->rdma_ch;
 
 		drvdata->substream[data->rdma_ch] = psubstream;
@@ -518,8 +518,10 @@  static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime)
 			data->wrdma_ch = v->alloc_dma_channel(drvdata,
 						SNDRV_PCM_STREAM_CAPTURE);
 
-		if (IS_ERR_VALUE(data->wrdma_ch))
+		if (data->wrdma_ch < 0) {
+			ret = data->wrdma_ch;
 			goto capture_alloc_err;
+		}
 
 		drvdata->substream[data->wrdma_ch] = csubstream;