[alsa-devel] [PATCH 1/3] ASoC: Intel: Skylake: Fix uninitialized pointer usage
Due to recent code move, one instance dev_err() was passed a wrong uninitialized pointer for the device, so fix it.
sound/soc/intel/skylake/bxt-sst.c: In function 'bxt_sst_dsp_init': sound/soc/intel/skylake/bxt-sst.c:567:14: warning: 'skl' may be used uninitialized in this function [-Wmaybe-uninitialized] dev_err(skl->dev, "%s: no device\n", __func__); ^
Fixes: 9fe9c7119283 ("ASoC: Intel: Skylake: Move sst common initialization to a helper function") Reported-by: Stephen Rothwell sfr@canb.auug.org.au Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/soc/intel/skylake/bxt-sst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c index fde4bc0f35b0..f5e7dbb1ba39 100644 --- a/sound/soc/intel/skylake/bxt-sst.c +++ b/sound/soc/intel/skylake/bxt-sst.c @@ -564,7 +564,7 @@ int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
ret = skl_sst_ctx_init(dev, irq, fw_name, dsp_ops, dsp, &skl_dev); if (ret < 0) { - dev_err(skl->dev, "%s: no device\n", __func__); + dev_err(dev, "%s: no device\n", __func__); return ret; }
With compiler option W=1, we have one more warning in the driver for 'set but unused variable', so remove the unused variable to fix it.
sound/soc/intel/skylake/skl-pcm.c: In function ‘skl_platform_open’: sound/soc/intel/skylake/skl-pcm.c:954:26: warning: variable ‘runtime’ set but not used [-Wunused-but-set-variable] struct snd_pcm_runtime *runtime;
Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/soc/intel/skylake/skl-pcm.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c index d43d1976dd3b..e91bbcffc856 100644 --- a/sound/soc/intel/skylake/skl-pcm.c +++ b/sound/soc/intel/skylake/skl-pcm.c @@ -951,14 +951,12 @@ static int skl_link_hw_free(struct snd_pcm_substream *substream,
static int skl_platform_open(struct snd_pcm_substream *substream) { - struct snd_pcm_runtime *runtime; struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_dai_link *dai_link = rtd->dai_link;
dev_dbg(rtd->cpu_dai->dev, "In %s:%s\n", __func__, dai_link->cpu_dai_name);
- runtime = substream->runtime; snd_soc_set_runtime_hwparams(substream, &azx_pcm_hw);
return 0;
The patch
ASoC: Intel: Skylake: Fix unused variable warning
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 9ed4aefe6f5f7e1dfe6abe8b15cfc8c48963b6c0 Mon Sep 17 00:00:00 2001
From: Vinod Koul vinod.koul@intel.com Date: Thu, 27 Apr 2017 12:21:21 +0530 Subject: [PATCH] ASoC: Intel: Skylake: Fix unused variable warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit
With compiler option W=1, we have one more warning in the driver for 'set but unused variable', so remove the unused variable to fix it.
sound/soc/intel/skylake/skl-pcm.c: In function ‘skl_platform_open’: sound/soc/intel/skylake/skl-pcm.c:954:26: warning: variable ‘runtime’ set but not used [-Wunused-but-set-variable] struct snd_pcm_runtime *runtime;
Signed-off-by: Vinod Koul vinod.koul@intel.com Reviewed-by: Takashi Sakamoto o-takashi@sakamocchi.jp Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/intel/skylake/skl-pcm.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c index d43d1976dd3b..e91bbcffc856 100644 --- a/sound/soc/intel/skylake/skl-pcm.c +++ b/sound/soc/intel/skylake/skl-pcm.c @@ -951,14 +951,12 @@ static struct snd_soc_dai_driver skl_platform_dai[] = {
static int skl_platform_open(struct snd_pcm_substream *substream) { - struct snd_pcm_runtime *runtime; struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_dai_link *dai_link = rtd->dai_link;
dev_dbg(rtd->cpu_dai->dev, "In %s:%s\n", __func__, dai_link->cpu_dai_name);
- runtime = substream->runtime; snd_soc_set_runtime_hwparams(substream, &azx_pcm_hw);
return 0;
From: Guneshwor Singh guneshwor.o.singh@intel.com
skl_tplg_add_pipe() returned EEXIST instead of negative EEXIST, so fix that and handle the return value as well.
Signed-off-by: Guneshwor Singh guneshwor.o.singh@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com --- sound/soc/intel/skylake/skl-topology.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c index 0e459d3eb17a..29f68713a231 100644 --- a/sound/soc/intel/skylake/skl-topology.c +++ b/sound/soc/intel/skylake/skl-topology.c @@ -1711,7 +1711,7 @@ static int skl_tplg_add_pipe(struct device *dev, list_for_each_entry(ppl, &skl->ppl_list, node) { if (ppl->pipe->ppl_id == tkn_elem->value) { mconfig->pipe = ppl->pipe; - return EEXIST; + return -EEXIST; } }
@@ -2003,11 +2003,13 @@ static int skl_tplg_get_token(struct device *dev, ret = skl_tplg_add_pipe(dev, mconfig, skl, tkn_elem);
- if (ret < 0) + if (ret < 0) { + if (ret == -EEXIST) { + is_pipe_exists = 1; + break; + } return is_pipe_exists; - - if (ret == EEXIST) - is_pipe_exists = 1; + }
break;
The patch
ASoC: Intel: Skylake: Return negative error code
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 081dc8ab46df85382658822e951ea79be87382b0 Mon Sep 17 00:00:00 2001
From: Guneshwor Singh guneshwor.o.singh@intel.com Date: Thu, 27 Apr 2017 12:21:22 +0530 Subject: [PATCH] ASoC: Intel: Skylake: Return negative error code
skl_tplg_add_pipe() returned EEXIST instead of negative EEXIST, so fix that and handle the return value as well.
Signed-off-by: Guneshwor Singh guneshwor.o.singh@intel.com Signed-off-by: Vinod Koul vinod.koul@intel.com Reviewed-by: Takashi Sakamoto o-takashi@sakamocchi.jp Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/intel/skylake/skl-topology.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c index 0e459d3eb17a..29f68713a231 100644 --- a/sound/soc/intel/skylake/skl-topology.c +++ b/sound/soc/intel/skylake/skl-topology.c @@ -1711,7 +1711,7 @@ static int skl_tplg_add_pipe(struct device *dev, list_for_each_entry(ppl, &skl->ppl_list, node) { if (ppl->pipe->ppl_id == tkn_elem->value) { mconfig->pipe = ppl->pipe; - return EEXIST; + return -EEXIST; } }
@@ -2003,11 +2003,13 @@ static int skl_tplg_get_token(struct device *dev, ret = skl_tplg_add_pipe(dev, mconfig, skl, tkn_elem);
- if (ret < 0) + if (ret < 0) { + if (ret == -EEXIST) { + is_pipe_exists = 1; + break; + } return is_pipe_exists; - - if (ret == EEXIST) - is_pipe_exists = 1; + }
break;
On Apr 27 2017 15:51, Vinod Koul wrote:
Due to recent code move, one instance dev_err() was passed a wrong uninitialized pointer for the device, so fix it.
sound/soc/intel/skylake/bxt-sst.c: In function 'bxt_sst_dsp_init': sound/soc/intel/skylake/bxt-sst.c:567:14: warning: 'skl' may be used uninitialized in this function [-Wmaybe-uninitialized] dev_err(skl->dev, "%s: no device\n", __func__); ^
Fixes: 9fe9c7119283 ("ASoC: Intel: Skylake: Move sst common initialization to a helper function") Reported-by: Stephen Rothwell sfr@canb.auug.org.au Signed-off-by: Vinod Koul vinod.koul@intel.com
sound/soc/intel/skylake/bxt-sst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Takashi Sakamoto o-takashi@sakamocchi.jp
Dan and Colin were also going to fix this apparent bug. It's nice to add their contribution, I think.
Suggested-by: Dan Carpenter dan.carpenter@oracle.com Suggested-by: Colin King colin.king@canonical.com
http://mailman.alsa-project.org/pipermail/alsa-devel/2017-April/120225.html http://mailman.alsa-project.org/pipermail/alsa-devel/2017-April/120242.html
diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c index fde4bc0f35b0..f5e7dbb1ba39 100644 --- a/sound/soc/intel/skylake/bxt-sst.c +++ b/sound/soc/intel/skylake/bxt-sst.c @@ -564,7 +564,7 @@ int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
ret = skl_sst_ctx_init(dev, irq, fw_name, dsp_ops, dsp, &skl_dev); if (ret < 0) {
dev_err(skl->dev, "%s: no device\n", __func__);
return ret; }dev_err(dev, "%s: no device\n", __func__);
Regards
Takashi Sakamoto
On Fri, Apr 28, 2017 at 07:46:27AM +0900, Takashi Sakamoto wrote:
On Apr 27 2017 15:51, Vinod Koul wrote:
Due to recent code move, one instance dev_err() was passed a wrong uninitialized pointer for the device, so fix it.
sound/soc/intel/skylake/bxt-sst.c: In function 'bxt_sst_dsp_init': sound/soc/intel/skylake/bxt-sst.c:567:14: warning: 'skl' may be used uninitialized in this function [-Wmaybe-uninitialized] dev_err(skl->dev, "%s: no device\n", __func__); ^
Fixes: 9fe9c7119283 ("ASoC: Intel: Skylake: Move sst common initialization to a helper function") Reported-by: Stephen Rothwell sfr@canb.auug.org.au Signed-off-by: Vinod Koul vinod.koul@intel.com
sound/soc/intel/skylake/bxt-sst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Takashi Sakamoto o-takashi@sakamocchi.jp
Dan and Colin were also going to fix this apparent bug. It's nice to add their contribution, I think.
Suggested-by: Dan Carpenter dan.carpenter@oracle.com Suggested-by: Colin King colin.king@canonical.com
you missed Arnd :)
So based on this rule we should also add: Suggested-by: Arnd Bergmann arnd@arndb.de
http://mailman.alsa-project.org/pipermail/alsa-devel/2017-April/120225.html http://mailman.alsa-project.org/pipermail/alsa-devel/2017-April/120242.html
diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c index fde4bc0f35b0..f5e7dbb1ba39 100644 --- a/sound/soc/intel/skylake/bxt-sst.c +++ b/sound/soc/intel/skylake/bxt-sst.c @@ -564,7 +564,7 @@ int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
ret = skl_sst_ctx_init(dev, irq, fw_name, dsp_ops, dsp, &skl_dev); if (ret < 0) {
dev_err(skl->dev, "%s: no device\n", __func__);
return ret; }dev_err(dev, "%s: no device\n", __func__);
Regards
Takashi Sakamoto
The patch
ASoC: Intel: Skylake: fix uninitialized pointer use
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 351d74e4d7eacaab2ed0092b855355d5e2907117 Mon Sep 17 00:00:00 2001
From: Arnd Bergmann arnd@arndb.de Date: Thu, 27 Apr 2017 12:59:58 +0200 Subject: [PATCH] ASoC: Intel: Skylake: fix uninitialized pointer use
The error handling in bxt_sst_dsp_init() got changed in a way that it now derefences an uninitialized pointer when printing a warning about the device not being found:
sound/soc/intel/skylake/bxt-sst.c: In function 'bxt_sst_dsp_init': sound/soc/intel/skylake/bxt-sst.c:567:14: error: 'skl' may be used uninitialized in this function [-Werror=maybe-uninitialized]
As we do have a valid device pointer available at the call site, let's use that instead.
Fixes: 9fe9c7119283 ("ASoC: Intel: Skylake: Move sst common initialization to a helper function") Signed-off-by: Arnd Bergmann arnd@arndb.de Reviewed-by: Takashi Sakamoto o-takashi@sakamocchi.jp Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/intel/skylake/bxt-sst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c index fde4bc0f35b0..f5e7dbb1ba39 100644 --- a/sound/soc/intel/skylake/bxt-sst.c +++ b/sound/soc/intel/skylake/bxt-sst.c @@ -564,7 +564,7 @@ int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
ret = skl_sst_ctx_init(dev, irq, fw_name, dsp_ops, dsp, &skl_dev); if (ret < 0) { - dev_err(skl->dev, "%s: no device\n", __func__); + dev_err(dev, "%s: no device\n", __func__); return ret; }
participants (3)
-
Mark Brown
-
Takashi Sakamoto
-
Vinod Koul