Skip to contentSkip to conversation

ASoC: Intel: Skylake: fix uninitialized pointer use

PATCH In review Arnd Bergmann 3 participants 3 messages Apr 27, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 sound/soc/intel/skylake/bxt-sst.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/skylake/bxt-sst.c +1 -1
index fde4bc0f35b0..f5e7dbb1ba39 100644
@@ -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.9.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Arnd Bergmann

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]

Quoted 8 lines

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")
---
 sound/soc/intel/skylake/bxt-sst.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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
index fde4bc0f35b0..f5e7dbb1ba39 100644
@@ -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

#2 lore raw
In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

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.

Thanks Arnd for this fix, but this was also reported by SFR earlier today and have pasoted same patch via
http://mailman.alsa-project.org/pipermail/alsa-devel/2017-April/120214.html

Patches are same, so Mark can take either :)

Signature · 1 line
~Vinod