sound/pci/asihpi/hpioctl.c:346:9: warning: missing braces around initializer
From: kernel test robot
Date: Sun Feb 14 2021 - 09:52:45 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: ac30d8ce28d61c05ac3a8b1452e889371136f3af
commit: 472eb39103e885f302fd8fd6eff104fcf5503f1b ALSA: asihpi: fix iounmap in error handler
date: 5 months ago
config: i386-randconfig-a014-20200624 (attached as .config)
compiler: gcc-4.9 (Ubuntu 4.9.3-13ubuntu2) 4.9.3
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=472eb39103e885f302fd8fd6eff104fcf5503f1b
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 472eb39103e885f302fd8fd6eff104fcf5503f1b
# save the attached .config to linux build tree
make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
sound/pci/asihpi/hpioctl.c: In function 'asihpi_adapter_probe':
>> sound/pci/asihpi/hpioctl.c:346:9: warning: missing braces around initializer [-Wmissing-braces]
struct hpi_pci pci = { 0 };
^
sound/pci/asihpi/hpioctl.c:346:9: warning: (near initialization for 'pci.ap_mem_base') [-Wmissing-braces]
vim +346 sound/pci/asihpi/hpioctl.c
336
337 int asihpi_adapter_probe(struct pci_dev *pci_dev,
338 const struct pci_device_id *pci_id)
339 {
340 int idx, nm, low_latency_mode = 0, irq_supported = 0;
341 int adapter_index;
342 unsigned int memlen;
343 struct hpi_message hm;
344 struct hpi_response hr;
345 struct hpi_adapter adapter;
> 346 struct hpi_pci pci = { 0 };
347
348 memset(&adapter, 0, sizeof(adapter));
349
350 dev_printk(KERN_DEBUG, &pci_dev->dev,
351 "probe %04x:%04x,%04x:%04x,%04x\n", pci_dev->vendor,
352 pci_dev->device, pci_dev->subsystem_vendor,
353 pci_dev->subsystem_device, pci_dev->devfn);
354
355 if (pci_enable_device(pci_dev) < 0) {
356 dev_err(&pci_dev->dev,
357 "pci_enable_device failed, disabling device\n");
358 return -EIO;
359 }
360
361 pci_set_master(pci_dev); /* also sets latency timer if < 16 */
362
363 hpi_init_message_response(&hm, &hr, HPI_OBJ_SUBSYSTEM,
364 HPI_SUBSYS_CREATE_ADAPTER);
365 hpi_init_response(&hr, HPI_OBJ_SUBSYSTEM, HPI_SUBSYS_CREATE_ADAPTER,
366 HPI_ERROR_PROCESSING_MESSAGE);
367
368 hm.adapter_index = HPI_ADAPTER_INDEX_INVALID;
369
370 nm = HPI_MAX_ADAPTER_MEM_SPACES;
371
372 for (idx = 0; idx < nm; idx++) {
373 HPI_DEBUG_LOG(INFO, "resource %d %pR\n", idx,
374 &pci_dev->resource[idx]);
375
376 if (pci_resource_flags(pci_dev, idx) & IORESOURCE_MEM) {
377 memlen = pci_resource_len(pci_dev, idx);
378 pci.ap_mem_base[idx] =
379 ioremap(pci_resource_start(pci_dev, idx),
380 memlen);
381 if (!pci.ap_mem_base[idx]) {
382 HPI_DEBUG_LOG(ERROR,
383 "ioremap failed, aborting\n");
384 /* unmap previously mapped pci mem space */
385 goto err;
386 }
387 }
388 }
389
390 pci.pci_dev = pci_dev;
391 hm.u.s.resource.bus_type = HPI_BUS_PCI;
392 hm.u.s.resource.r.pci = &pci;
393
394 /* call CreateAdapterObject on the relevant hpi module */
395 hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL);
396 if (hr.error)
397 goto err;
398
399 adapter_index = hr.u.s.adapter_index;
400 adapter.adapter = hpi_find_adapter(adapter_index);
401
402 if (prealloc_stream_buf) {
403 adapter.p_buffer = vmalloc(prealloc_stream_buf);
404 if (!adapter.p_buffer) {
405 HPI_DEBUG_LOG(ERROR,
406 "HPI could not allocate "
407 "kernel buffer size %d\n",
408 prealloc_stream_buf);
409 goto err;
410 }
411 }
412
413 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER,
414 HPI_ADAPTER_OPEN);
415 hm.adapter_index = adapter.adapter->index;
416 hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL);
417
418 if (hr.error) {
419 HPI_DEBUG_LOG(ERROR, "HPI_ADAPTER_OPEN failed, aborting\n");
420 goto err;
421 }
422
423 /* Check if current mode == Low Latency mode */
424 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER,
425 HPI_ADAPTER_GET_MODE);
426 hm.adapter_index = adapter.adapter->index;
427 hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL);
428
429 if (!hr.error
430 && hr.u.ax.mode.adapter_mode == HPI_ADAPTER_MODE_LOW_LATENCY)
431 low_latency_mode = 1;
432 else
433 dev_info(&pci_dev->dev,
434 "Adapter at index %d is not in low latency mode\n",
435 adapter.adapter->index);
436
437 /* Check if IRQs are supported */
438 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER,
439 HPI_ADAPTER_GET_PROPERTY);
440 hm.adapter_index = adapter.adapter->index;
441 hm.u.ax.property_set.property = HPI_ADAPTER_PROPERTY_SUPPORTS_IRQ;
442 hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL);
443 if (hr.error || !hr.u.ax.property_get.parameter1) {
444 dev_info(&pci_dev->dev,
445 "IRQs not supported by adapter at index %d\n",
446 adapter.adapter->index);
447 } else {
448 irq_supported = 1;
449 }
450
451 /* WARNING can't init mutex in 'adapter'
452 * and then copy it to adapters[] ?!?!
453 */
454 adapters[adapter_index] = adapter;
455 mutex_init(&adapters[adapter_index].mutex);
456 pci_set_drvdata(pci_dev, &adapters[adapter_index]);
457
458 if (low_latency_mode && irq_supported) {
459 if (!adapter.adapter->irq_query_and_clear) {
460 dev_err(&pci_dev->dev,
461 "no IRQ handler for adapter %d, aborting\n",
462 adapter.adapter->index);
463 goto err;
464 }
465
466 /* Disable IRQ generation on DSP side by setting the rate to 0 */
467 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER,
468 HPI_ADAPTER_SET_PROPERTY);
469 hm.adapter_index = adapter.adapter->index;
470 hm.u.ax.property_set.property = HPI_ADAPTER_PROPERTY_IRQ_RATE;
471 hm.u.ax.property_set.parameter1 = 0;
472 hm.u.ax.property_set.parameter2 = 0;
473 hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL);
474 if (hr.error) {
475 HPI_DEBUG_LOG(ERROR,
476 "HPI_ADAPTER_GET_MODE failed, aborting\n");
477 goto err;
478 }
479
480 /* Note: request_irq calls asihpi_isr here */
481 if (request_irq(pci_dev->irq, asihpi_isr, IRQF_SHARED,
482 "asihpi", &adapters[adapter_index])) {
483 dev_err(&pci_dev->dev, "request_irq(%d) failed\n",
484 pci_dev->irq);
485 goto err;
486 }
487
488 adapters[adapter_index].interrupt_mode = 1;
489
490 dev_info(&pci_dev->dev, "using irq %d\n", pci_dev->irq);
491 adapters[adapter_index].irq = pci_dev->irq;
492 } else {
493 dev_info(&pci_dev->dev, "using polled mode\n");
494 }
495
496 dev_info(&pci_dev->dev, "probe succeeded for ASI%04X HPI index %d\n",
497 adapter.adapter->type, adapter_index);
498
499 return 0;
500
501 err:
502 while (--idx >= 0) {
503 if (pci.ap_mem_base[idx]) {
504 iounmap(pci.ap_mem_base[idx]);
505 pci.ap_mem_base[idx] = NULL;
506 }
507 }
508
509 if (adapter.p_buffer) {
510 adapter.buffer_size = 0;
511 vfree(adapter.p_buffer);
512 }
513
514 HPI_DEBUG_LOG(ERROR, "adapter_probe failed\n");
515 return -ENODEV;
516 }
517
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip