Skip to contentSkip to conversation

sound/soc/intel/atom/sst/sst_acpi.c:311:12: warning: variable 'ctx' is uninitialized when used here

PATCH kernel test robot 1 participant 1 message Oct 26, 2024

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/ci.git asoc-6.12
head:   6668610b4d8ce9a3ee3ed61a9471f62fb5f05bf9
commit: 6668610b4d8ce9a3ee3ed61a9471f62fb5f05bf9 [30/30] ASoC: Intel: sst: Support LPE0F28 ACPI HID
config: x86_64-buildonly-randconfig-004-20241026 (https://download.01.org/0day-ci/archive/20241026/[email protected]/config)
compiler: clang version 19.1.2 (https://github.com/llvm/llvm-project 7ba7d8e2f7b6445b60679da826210cdde29eaf8b)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241026/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from sound/soc/intel/atom/sst/sst_acpi.c:24:
In file included from include/sound/soc.h:26:
In file included from include/sound/ac97_codec.h:17:
In file included from include/sound/pcm.h:15:
In file included from include/linux/mm.h:2213:
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]

     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> sound/soc/intel/atom/sst/sst_acpi.c:311:12: warning: variable 'ctx' is uninitialized when used here [-Wuninitialized]
     311 |                         dev_err(ctx->dev, "Invalid SHIM base\n");
         |                                 ^~~
   include/linux/dev_printk.h:154:44: note: expanded from macro 'dev_err'
     154 |         dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                   ^~~
   include/linux/dev_printk.h:110:11: note: expanded from macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                         ^~~
   sound/soc/intel/atom/sst/sst_acpi.c:260:27: note: initialize the variable 'ctx' to silence this warning
     260 |         struct intel_sst_drv *ctx;
         |                                  ^
         |                                   = NULL

2 warnings generated.

vim +/ctx +311 sound/soc/intel/atom/sst/sst_acpi.c

255
256 static int sst_acpi_probe(struct platform_device *pdev)
257 {
258 struct device *dev = &pdev->dev;
259 int ret = 0;
260 struct intel_sst_drv *ctx;
261 const struct acpi_device_id *id;
262 struct snd_soc_acpi_mach *mach;
263 struct platform_device *mdev;
264 struct platform_device *plat_dev;
265 struct sst_platform_info *pdata;
266 unsigned int dev_id;
267
268 id = acpi_match_device(dev->driver->acpi_match_table, dev);
269 if (!id)
270 return -ENODEV;
271
272 ret = snd_intel_acpi_dsp_driver_probe(dev, id->id);
273 if (ret != SND_INTEL_DSP_DRIVER_ANY && ret != SND_INTEL_DSP_DRIVER_SST) {
274 dev_dbg(dev, "SST ACPI driver not selected, aborting probe\n");
275 return -ENODEV;
276 }
277
278 dev_dbg(dev, "for %s\n", id->id);
279
280 mach = (struct snd_soc_acpi_mach *)id->driver_data;
281 mach = snd_soc_acpi_find_machine(mach);
282 if (mach == NULL) {
283 dev_err(dev, "No matching machine driver found\n");
284 return -ENODEV;
285 }
286
287 if (soc_intel_is_byt())
288 mach->pdata = &byt_rvp_platform_data;
289 else
290 mach->pdata = &chv_platform_data;
291 pdata = mach->pdata;
292
293 if (!strcmp(id->id, "LPE0F28")) {
294 struct resource *rsrc;
295
296 /* Use regular BYT SST PCI VID:PID */
297 dev_id = 0x80860F28;
298 byt_rvp_platform_data.res_info = &lpe8086_res_info;
299
300 /*
301 * The "LPE0F28" ACPI device has separate IO-mem resources for:
302 * DDR, SHIM, MBOX, IRAM, DRAM, CFG
303 * None of which covers the entire LPE base address range.
304 * lpe8086_res_info.acpi_lpe_res_index points to the SHIM.
305 * Patch this to cover the entire base address range as expected
306 * by sst_platform_get_resources().
307 */
308 rsrc = platform_get_resource(pdev, IORESOURCE_MEM,
309 pdata->res_info->acpi_lpe_res_index);
310 if (!rsrc) {

 > 311				dev_err(ctx->dev, "Invalid SHIM base\n");

312 return -EIO;
313 }
314 rsrc->start -= pdata->res_info->shim_offset;
315 rsrc->end = rsrc->start + 0x200000 - 1;
316 } else {
317 ret = kstrtouint(id->id, 16, &dev_id);
318 if (ret < 0) {
319 dev_err(dev, "Unique device id conversion error: %d\n", ret);
320 return ret;
321 }
322
323 if (soc_intel_is_byt_cr(pdev))
324 byt_rvp_platform_data.res_info = &bytcr_res_info;
325 }
326
327 dev_dbg(dev, "ACPI device id: %x\n", dev_id);
328
329 ret = sst_alloc_drv_context(&ctx, dev, dev_id);
330 if (ret < 0)
331 return ret;
332
333 /* update machine parameters */
334 mach->mach_params.acpi_ipc_irq_index =
335 pdata->res_info->acpi_ipc_irq_index;
336
337 plat_dev = platform_device_register_data(dev, pdata->platform, -1,
338 NULL, 0);
339 if (IS_ERR(plat_dev)) {
340 dev_err(dev, "Failed to create machine device: %s\n",
341 pdata->platform);
342 return PTR_ERR(plat_dev);
343 }
344
345 /*
346 * Create platform device for sst machine driver,
347 * pass machine info as pdata
348 */
349 mdev = platform_device_register_data(dev, mach->drv_name, -1,
350 (const void *)mach, sizeof(*mach));
351 if (IS_ERR(mdev)) {
352 dev_err(dev, "Failed to create machine device: %s\n",
353 mach->drv_name);
354 return PTR_ERR(mdev);
355 }
356
357 /* Fill sst platform data */
358 ctx->pdata = pdata;
359 strcpy(ctx->firmware_name, mach->fw_filename);
360
361 ret = sst_platform_get_resources(ctx);
362 if (ret)
363 return ret;
364
365 ret = sst_context_init(ctx);
366 if (ret < 0)
367 return ret;
368
369 sst_configure_runtime_pm(ctx);
370 platform_set_drvdata(pdev, ctx);
371 return ret;
372 }
373

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki