Skip to content

Upstream: fix smatch warnings for hdev usages #492

@plbossart

Description

@plbossart

reported by Dan Carpenter/Smatch. Adding both @bardliao and @keyonjie since this may impact both in-flight fixes.

smatch warnings:
sound/soc/sof/intel/hda.c:579 hda_dsp_remove() error: we previously assumed 'hda' could be null (see line 559)
sound/soc/sof/intel/hda-trace.c:49 hda_dsp_trace_init() warn: variable dereferenced before check 'hda' (see line 46)
sound/soc/sof/intel/hda-trace.c:55 hda_dsp_trace_init() error: we previously assumed 'hda->dtrace_stream' could be null (see line 49)

# https://github.com/plbossart/sound/commit/f395dd273254cd66d28ae0b24e54ec0871d435ff
git remote add plbossart-sound https://github.com/plbossart/sound
git remote update plbossart-sound
git checkout f395dd273254cd66d28ae0b24e54ec0871d435ff
vim +/hda +579 sound/soc/sof/intel/hda.c

fa06c6de Bard liao            2018-11-23  558  
f395dd27 Bard liao            2018-12-19 @559  	if (hda && (!IS_ERR_OR_NULL(hda->dmic_dev)))
                                                    ^^^
Is this check required?

f395dd27 Bard liao            2018-12-19  560  		platform_device_unregister(hda->dmic_dev);
5d7f0748 Pierre-Louis Bossart 2018-10-31  561  
def495eb Liam Girdwood        2018-01-08  562  	/* disable DSP IRQ */
def495eb Liam Girdwood        2018-01-08  563  	snd_sof_dsp_update_bits(sdev, HDA_DSP_PP_BAR, SOF_HDA_REG_PP_PPCTL,
def495eb Liam Girdwood        2018-01-08  564  				SOF_HDA_PPCTL_PIE, 0);
def495eb Liam Girdwood        2018-01-08  565  
def495eb Liam Girdwood        2018-01-08  566  	/* disable CIE and GIE interrupts */
def495eb Liam Girdwood        2018-01-08  567  	snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, SOF_HDA_INTCTL,
def495eb Liam Girdwood        2018-01-08  568  				SOF_HDA_INT_CTRL_EN | SOF_HDA_INT_GLOBAL_EN, 0);
def495eb Liam Girdwood        2018-01-08  569  
def495eb Liam Girdwood        2018-01-08  570  	/* disable cores */
def495eb Liam Girdwood        2018-01-08  571  	if (chip)
def495eb Liam Girdwood        2018-01-08  572  		hda_dsp_core_reset_power_down(sdev, chip->cores_mask);
def495eb Liam Girdwood        2018-01-08  573  
def495eb Liam Girdwood        2018-01-08  574  	/* disable DSP */
def495eb Liam Girdwood        2018-01-08  575  	snd_sof_dsp_update_bits(sdev, HDA_DSP_PP_BAR, SOF_HDA_REG_PP_PPCTL,
def495eb Liam Girdwood        2018-01-08  576  				SOF_HDA_PPCTL_GPROCEN, 0);
def495eb Liam Girdwood        2018-01-08  577  
def495eb Liam Girdwood        2018-01-08  578  	free_irq(sdev->ipc_irq, sdev);
f395dd27 Bard liao            2018-12-19 @579  	free_irq(hda->irq, bus);
                                                         ^^^^^^^^
Not checked here.

7032cf60 Libin Yang           2018-11-28  580  	if (sdev->msi_enabled)
def495eb Liam Girdwood        2018-01-08  581  		pci_free_irq_vectors(pci);
def495eb Liam Girdwood        2018-01-08  582  
def495eb Liam Girdwood        2018-01-08  583  	hda_dsp_stream_free(sdev);
fa06c6de Bard liao            2018-11-23  584  #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
fa06c6de Bard liao            2018-11-23  585  	snd_hdac_link_free_all(bus);
fa06c6de Bard liao            2018-11-23  586  #endif
893e7e85 Pierre-Louis Bossart 2018-11-12  587  
893e7e85 Pierre-Louis Bossart 2018-11-12  588  	iounmap(sdev->bar[HDA_DSP_BAR]);
893e7e85 Pierre-Louis Bossart 2018-11-12  589  	iounmap(bus->remap_addr);
893e7e85 Pierre-Louis Bossart 2018-11-12  590  

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions