[alsa-devel] [asoc:topic/intel 52/54] sound/soc/intel/skylake/skl-messages.c:320:9: warning: 'ret' may be used uninitialized in this function
kbuild test robot
fengguang.wu at intel.com
Wed Aug 23 15:23:36 CEST 2017
tree: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git topic/intel
head: 7b992c24de78a206b3abd07192686d2d5db5012c
commit: f77d443c4c299aff5ad9c74811dd063f4d8bebcf [52/54] ASoC: Intel: Skylake: Fix to free resources for dsp_init failure
config: x86_64-randconfig-ne0-08232016 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
git checkout f77d443c4c299aff5ad9c74811dd063f4d8bebcf
# save the attached .config to linux build tree
make ARCH=x86_64
Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
All warnings (new ones prefixed by >>):
sound/soc/intel/skylake/skl-messages.c: In function 'skl_init_dsp':
>> sound/soc/intel/skylake/skl-messages.c:320:9: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
return ret;
^~~
vim +/ret +320 sound/soc/intel/skylake/skl-messages.c
bc23ca35c Jeeja KP 2016-03-11 256
d255b0955 Jeeja KP 2015-07-21 257 int skl_init_dsp(struct skl *skl)
d255b0955 Jeeja KP 2015-07-21 258 {
d255b0955 Jeeja KP 2015-07-21 259 void __iomem *mmio_base;
d255b0955 Jeeja KP 2015-07-21 260 struct hdac_ext_bus *ebus = &skl->ebus;
d255b0955 Jeeja KP 2015-07-21 261 struct hdac_bus *bus = ebus_to_hbus(ebus);
d255b0955 Jeeja KP 2015-07-21 262 struct skl_dsp_loader_ops loader_ops;
bc23ca35c Jeeja KP 2016-03-11 263 int irq = bus->irq;
73a675816 Vinod Koul 2016-07-26 264 const struct skl_dsp_ops *ops;
f0a550a88 Guneshwor Singh 2017-08-02 265 struct skl_dsp_cores *cores;
73a675816 Vinod Koul 2016-07-26 266 int ret;
d255b0955 Jeeja KP 2015-07-21 267
d255b0955 Jeeja KP 2015-07-21 268 /* enable ppcap interrupt */
d255b0955 Jeeja KP 2015-07-21 269 snd_hdac_ext_bus_ppcap_enable(&skl->ebus, true);
d255b0955 Jeeja KP 2015-07-21 270 snd_hdac_ext_bus_ppcap_int_enable(&skl->ebus, true);
d255b0955 Jeeja KP 2015-07-21 271
d255b0955 Jeeja KP 2015-07-21 272 /* read the BAR of the ADSP MMIO */
d255b0955 Jeeja KP 2015-07-21 273 mmio_base = pci_ioremap_bar(skl->pci, 4);
d255b0955 Jeeja KP 2015-07-21 274 if (mmio_base == NULL) {
d255b0955 Jeeja KP 2015-07-21 275 dev_err(bus->dev, "ioremap error\n");
d255b0955 Jeeja KP 2015-07-21 276 return -ENXIO;
d255b0955 Jeeja KP 2015-07-21 277 }
d255b0955 Jeeja KP 2015-07-21 278
73a675816 Vinod Koul 2016-07-26 279 ops = skl_get_dsp_ops(skl->pci->device);
f77d443c4 Subhransu S. Prusty 2017-08-22 280 if (!ops) {
f77d443c4 Subhransu S. Prusty 2017-08-22 281 goto unmap_mmio;
f77d443c4 Subhransu S. Prusty 2017-08-22 282 ret = -EIO;
f77d443c4 Subhransu S. Prusty 2017-08-22 283 }
bc23ca35c Jeeja KP 2016-03-11 284
73a675816 Vinod Koul 2016-07-26 285 loader_ops = ops->loader_ops();
73a675816 Vinod Koul 2016-07-26 286 ret = ops->init(bus->dev, mmio_base, irq,
73a675816 Vinod Koul 2016-07-26 287 skl->fw_name, loader_ops,
73a675816 Vinod Koul 2016-07-26 288 &skl->skl_sst);
bc23ca35c Jeeja KP 2016-03-11 289
2ac454ffe Jeeja KP 2015-10-22 290 if (ret < 0)
f77d443c4 Subhransu S. Prusty 2017-08-22 291 goto unmap_mmio;
2ac454ffe Jeeja KP 2015-10-22 292
7bd86a305 G Kranthi 2017-03-13 293 skl->skl_sst->dsp_ops = ops;
f0a550a88 Guneshwor Singh 2017-08-02 294 cores = &skl->skl_sst->cores;
f0a550a88 Guneshwor Singh 2017-08-02 295 cores->count = ops->num_cores;
f0a550a88 Guneshwor Singh 2017-08-02 296
f0a550a88 Guneshwor Singh 2017-08-02 297 cores->state = kcalloc(cores->count, sizeof(*cores->state), GFP_KERNEL);
f77d443c4 Subhransu S. Prusty 2017-08-22 298 if (!cores->state) {
f77d443c4 Subhransu S. Prusty 2017-08-22 299 ret = -ENOMEM;
f77d443c4 Subhransu S. Prusty 2017-08-22 300 goto unmap_mmio;
f77d443c4 Subhransu S. Prusty 2017-08-22 301 }
f0a550a88 Guneshwor Singh 2017-08-02 302
f0a550a88 Guneshwor Singh 2017-08-02 303 cores->usage_count = kcalloc(cores->count, sizeof(*cores->usage_count),
f0a550a88 Guneshwor Singh 2017-08-02 304 GFP_KERNEL);
f0a550a88 Guneshwor Singh 2017-08-02 305 if (!cores->usage_count) {
f77d443c4 Subhransu S. Prusty 2017-08-22 306 ret = -ENOMEM;
f77d443c4 Subhransu S. Prusty 2017-08-22 307 goto free_core_state;
f0a550a88 Guneshwor Singh 2017-08-02 308 }
363d45385 Dharageswari R 2017-08-02 309
d255b0955 Jeeja KP 2015-07-21 310 dev_dbg(bus->dev, "dsp registration status=%d\n", ret);
d255b0955 Jeeja KP 2015-07-21 311
f77d443c4 Subhransu S. Prusty 2017-08-22 312 return 0;
f77d443c4 Subhransu S. Prusty 2017-08-22 313
f77d443c4 Subhransu S. Prusty 2017-08-22 314 free_core_state:
f77d443c4 Subhransu S. Prusty 2017-08-22 315 kfree(cores->state);
f77d443c4 Subhransu S. Prusty 2017-08-22 316
f77d443c4 Subhransu S. Prusty 2017-08-22 317 unmap_mmio:
f77d443c4 Subhransu S. Prusty 2017-08-22 318 iounmap(mmio_base);
f77d443c4 Subhransu S. Prusty 2017-08-22 319
d255b0955 Jeeja KP 2015-07-21 @320 return ret;
d255b0955 Jeeja KP 2015-07-21 321 }
d255b0955 Jeeja KP 2015-07-21 322
:::::: The code at line 320 was first introduced by commit
:::::: d255b09555e8ea0e517a4d3368ec60097ac9cf96 ASoC: Intel: Skylake: Add dsp and ipc init helpers
:::::: TO: Jeeja KP <jeeja.kp at intel.com>
:::::: CC: Mark Brown <broonie at kernel.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 31998 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20170823/bec20577/attachment-0001.bin>
More information about the Alsa-devel
mailing list