ASoC: Intel: Skylake: Fix uninitialized pointer usage
Subsystems (3)
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__);
^--- sound/soc/intel/skylake/bxt-sst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/skylake/bxt-sst.c +1 -1
@@ -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; }
Signature · 1 line
1.9.1
PATCH 2/3 ASoC: Intel: Skylake: Fix unused variable warning
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;
--- sound/soc/intel/skylake/skl-pcm.c | 2 -- 1 file changed, 2 deletions(-)
sound/soc/intel/skylake/skl-pcm.c +0 -2
@@ -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 ;
Signature · 6 lines
1.9.1 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainerApplied "ASoC: Intel: Skylake: Fix unused variable warning" to the asoc tree
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
Quoted 1 line
From
9ed4aefe6f5f7e1dfe6abe8b15cfc8c48963b6c0Mon Sep 17 00:00:00 2001
From: Vinod Koul <[email protected]>
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;
--- sound/soc/intel/skylake/skl-pcm.c | 2 -- 1 file changed, 2 deletions(-)
sound/soc/intel/skylake/skl-pcm.c +0 -2
@@ -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 ;
Signature · 1 line
2.11.0
PATCH 3/3 ASoC: Intel: Skylake: Return negative error code
In reply to Vinod KoulFrom: Guneshwor Singh <[email protected]>
skl_tplg_add_pipe() returned EEXIST instead of negative EEXIST, so fix that and handle the return value as well.
--- sound/soc/intel/skylake/skl-topology.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
sound/soc/intel/skylake/skl-topology.c +7 -5
@@ -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 ;
Signature · 1 line
1.9.1
Mark Brown
maintainerApplied "ASoC: Intel: Skylake: Return negative error code" to the asoc tree
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
Quoted 1 line
From
081dc8ab46df85382658822e951ea79be87382b0Mon Sep 17 00:00:00 2001
From: Guneshwor Singh <[email protected]>
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.
--- sound/soc/intel/skylake/skl-topology.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
sound/soc/intel/skylake/skl-topology.c +7 -5
@@ -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 ;
Signature · 1 line
2.11.0
Quoted 8 lines · Vinod Koul
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__); ^
Quoted 6 lines
Fixes 9fe9c7119283 ("ASoC: Intel: Skylake: Move sst common initialization to a helper function")Reported-by Stephen Rothwell <[email protected]>Signed-off-by Vinod Koul <[email protected]>--- sound/soc/intel/skylake/bxt-sst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Dan and Colin were also going to fix this apparent bug. It's nice to add their contribution, I think.
http://mailman.alsa-project.org/pipermail/alsa-devel/2017-April/120225.html
http://mailman.alsa-project.org/pipermail/alsa-devel/2017-April/120242.html
sound/soc/intel/skylake/bxt-sst.c int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq, · line 569
Quoted 12 lines
sound/soc/intel/skylake/bxt-sst.c +1
-1@@ -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; }
Regards
Takashi Sakamoto
Quoted 16 lines · Takashi Sakamoto
Quoted 8 lines · Vinod Koul
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__); ^Quoted 6 lines
Fixes 9fe9c7119283 ("ASoC: Intel: Skylake: Move sst common initialization to a helper function")Reported-by Stephen Rothwell <[email protected]>Signed-off-by Vinod Koul <[email protected]>--- sound/soc/intel/skylake/bxt-sst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 7 lines
Reviewed-by Takashi Sakamoto <[email protected]>Dan and Colin were also going to fix this apparent bug. It's nice to add their contribution, I think.
Suggested-by Dan Carpenter <[email protected]>Suggested-by Colin King <[email protected]>
you missed Arnd :)
So based on this rule we should also add:
Quoted 21 lines
http://mailman.alsa-project.org/pipermail/alsa-devel/2017-April/120225.html
http://mailman.alsa-project.org/pipermail/alsa-devel/2017-April/120242.htmlsound/soc/intel/skylake/bxt-sst.c int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq, · line 569
Quoted 12 lines
sound/soc/intel/skylake/bxt-sst.c +1
-1@@ -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; }Regards
Takashi Sakamoto
Signature · 1 line
~Vinod
Mark Brown
maintainerApplied "ASoC: Intel: Skylake: fix uninitialized pointer use" to the asoc tree
In reply to Vinod KoulThe 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
Quoted 1 line
From
351d74e4d7eacaab2ed0092b855355d5e2907117Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <[email protected]>
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.
--- sound/soc/intel/skylake/bxt-sst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/skylake/bxt-sst.c +1 -1
@@ -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; }
Signature · 1 line
2.11.0