From: Shengjiu Wang <shengjiu.wang@freescale.com>
To: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz,
tiwai@suse.de, nicoleotsuka@gmail.com, Li.Xiubo@freescale.com,
shc_work@mail.ru, fabio.estevam@freescale.com,
shengjiu.wang@freescale.com, xobs@kosagi.com, arnd@arndb.de,
sfr@canb.auug.org.au, timur@tabi.org
Cc: alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org
Subject: [PATCH V1 2/3] ASoC: fsl-asoc-card: Fix build warning for maybe-uninitialized
Date: Mon, 18 Aug 2014 16:38:39 +0800 [thread overview]
Message-ID: <b1711ff2c73f3b6acd6af000bc8294d930bbf16b.1408350626.git.shengjiu.wang@freescale.com> (raw)
In-Reply-To: <cover.1408350626.git.shengjiu.wang@freescale.com>
When build fsl-asoc-card as module, there is following error:
sound/soc/fsl/fsl-asoc-card.c: In function 'fsl_asoc_card_probe':
>> sound/soc/fsl/fsl-asoc-card.c:547:13: warning: 'asrc_np' may be used uninitialized in this function [-Wmaybe-uninitialized]
of_node_put(asrc_np);
^
vim +/asrc_np +547 sound/soc/fsl/fsl-asoc-card.c
531 if (width == 24)
532 priv->asrc_format = SNDRV_PCM_FORMAT_S24_LE;
533 else
534 priv->asrc_format = SNDRV_PCM_FORMAT_S16_LE;
535 }
536
537 /* Finish card registering */
538 platform_set_drvdata(pdev, priv);
539 snd_soc_card_set_drvdata(&priv->card, priv);
540
541 ret = devm_snd_soc_register_card(&pdev->dev, &priv->card);
542 if (ret)
543 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
544
545 fail:
546 of_node_put(codec_np);
> 547 of_node_put(asrc_np);
548 of_node_put(cpu_np);
549
550 return ret;
551 }
552
553 static const struct of_device_id fsl_asoc_card_dt_ids[] = {
554 { .compatible = "fsl,imx-audio-cs42888", },
555 { .compatible = "fsl,imx-audio-sgtl5000", },
Add 'asrc_fail' branch for error jump after asrc_np initialized.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
---
sound/soc/fsl/fsl-asoc-card.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c
index cf3f1f4..007c772 100644
--- a/sound/soc/fsl/fsl-asoc-card.c
+++ b/sound/soc/fsl/fsl-asoc-card.c
@@ -469,7 +469,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
ret = fsl_asoc_card_audmux_init(np, priv);
if (ret) {
dev_err(&pdev->dev, "failed to init audmux\n");
- goto fail;
+ goto asrc_fail;
}
} else if (strstr(cpu_np->name, "esai")) {
priv->cpu_priv.sysclk_id[1] = ESAI_HCKT_EXTAL;
@@ -518,14 +518,14 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
if (ret) {
dev_err(&pdev->dev, "failed to get output rate\n");
ret = -EINVAL;
- goto fail;
+ goto asrc_fail;
}
ret = of_property_read_u32(asrc_np, "fsl,asrc-width", &width);
if (ret) {
dev_err(&pdev->dev, "failed to get output rate\n");
ret = -EINVAL;
- goto fail;
+ goto asrc_fail;
}
if (width == 24)
@@ -542,9 +542,10 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
if (ret)
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
+asrc_fail:
+ of_node_put(asrc_np);
fail:
of_node_put(codec_np);
- of_node_put(asrc_np);
of_node_put(cpu_np);
return ret;
--
1.7.9.5
next prev parent reply other threads:[~2014-08-18 8:39 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-18 8:38 [PATCH V1 0/3] fix build error/warning in sound/soc/fsl Shengjiu Wang
2014-08-18 8:38 ` [PATCH V1 1/3] ASoC: fsl: Kconfig: remove dependence of SND_IMX_SOC for SND_SOC_IMX_PCM_DMA Shengjiu Wang
2014-08-18 16:52 ` Lars-Peter Clausen
2014-08-19 7:41 ` Shengjiu Wang
2014-08-19 8:13 ` Li.Xiubo
2014-08-19 8:21 ` Shengjiu Wang
2014-08-19 8:31 ` Li.Xiubo
2014-08-19 9:00 ` Li.Xiubo
2014-08-19 9:05 ` shengjiu.wang
2014-08-19 10:35 ` Takashi Iwai
2014-08-19 10:39 ` Lars-Peter Clausen
2014-08-19 8:36 ` Lars-Peter Clausen
2014-08-19 8:45 ` Lars-Peter Clausen
2014-08-19 8:55 ` Shengjiu Wang
2014-08-18 8:38 ` Shengjiu Wang [this message]
2014-08-18 14:53 ` [PATCH V1 2/3] ASoC: fsl-asoc-card: Fix build warning for maybe-uninitialized Mark Brown
2014-08-18 8:38 ` [PATCH V1 3/3] ASoC: fsl: fsl-asoc-card: Select SND_SOC_IMX_AUDMUX Shengjiu Wang
2014-08-18 14:54 ` Mark Brown
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=b1711ff2c73f3b6acd6af000bc8294d930bbf16b.1408350626.git.shengjiu.wang@freescale.com \
--to=shengjiu.wang@freescale.com \
--cc=Li.Xiubo@freescale.com \
--cc=alsa-devel@alsa-project.org \
--cc=arnd@arndb.de \
--cc=broonie@kernel.org \
--cc=fabio.estevam@freescale.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=nicoleotsuka@gmail.com \
--cc=perex@perex.cz \
--cc=sfr@canb.auug.org.au \
--cc=shc_work@mail.ru \
--cc=timur@tabi.org \
--cc=tiwai@suse.de \
--cc=xobs@kosagi.com \
/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).