linux icon indicating copy to clipboard operation
linux copied to clipboard

Build test errors of AMD

Open bardliao opened this issue 7 months ago • 8 comments

Sparse check reports

sound/soc/amd/acp/amd-acpi-mach.c:11:28: error: symbol 'amp_rt1019' was not declared. Should it be static?
sound/soc/amd/acp/amd-acpi-mach.c:16:28: error: symbol 'amp_max' was not declared. Should it be static?
sound/soc/amd/acp/amd-acpi-mach.c:21:26: error: symbol 'snd_soc_acpi_amd_acp_machines' was not declared. Should it be static?
sound/soc/amd/acp/amd-acpi-mach.c:52:26: error: symbol 'snd_soc_acpi_amd_rmb_acp_machines' was not declared. Should it be static?
sound/soc/amd/acp/amd-acpi-mach.c:73:26: error: symbol 'snd_soc_acpi_amd_acp63_acp_machines' was not declared. Should it be static?
sound/soc/amd/acp/amd-acpi-mach.c:82:26: error: symbol 'snd_soc_acpi_amd_acp70_acp_machines' was not declared. Should it be static?

And GCC static -fanalyzer reports

sound/soc/amd/acp/acp-legacy-common.c: In function ‘acp_irq_handler’:
sound/soc/amd/acp/acp-legacy-common.c:103:44: error: use of uninitialized value ‘ext_intr_stat1’ [CWE-457] [-Werror=analyzer-use-of-uninitialized-value]
  103 |                         if (ext_intr_stat1 & stream->irq_bit) {
      |                             ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
  ‘acp_irq_handler’: events 1-3
    |
    |   87 |         u32 ext_intr_stat, ext_intr_stat1;
    |      |                            ^~~~~~~~~~~~~~
    |      |                            |
    |      |                            (1) region created on stack here
    |      |                            (2) capacity: 4 bytes
    |   88 | 
    |   89 |         if (rsrc->no_of_ctrls == 2)
    |      |            ~                
    |      |            |
    |      |            (3) following ‘false’ branch...
    |
  ‘acp_irq_handler’: event 4
    |
    |sound/soc/amd/acp/chip_offset_byte.h:33:14:
    |   33 |         (chip->base + chip->rsrc->irq_reg_offset + offset + (ctrl * 0x04))
sound/soc/amd/acp/chip_offset_byte.h:37:44: note: in expansion of macro ‘ACP_EXTERNAL_INTR_REG_ADDR’
    |   37 | #define ACP_EXTERNAL_INTR_STAT(chip, ctrl) ACP_EXTERNAL_INTR_REG_ADDR(chip, \
    |      |                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/amd/acp/acp-legacy-common.c:92:31: note: in expansion of macro ‘ACP_EXTERNAL_INTR_STAT’
    |   92 |         ext_intr_stat = readl(ACP_EXTERNAL_INTR_STAT(chip, rsrc->irqp_used));
    |      |                               ^~~~~~~~~~~~~~~~~~~~~~
    |
  ‘acp_irq_handler’: event 5
    |
    |./include/linux/list.h:771:14:
    |  771 |              !list_entry_is_head(pos, head, member);                    \
    |      |              ^
    |      |              |
    |      |              (5) following ‘true’ branch...
sound/soc/amd/acp/acp-legacy-common.c:95:9: note: in expansion of macro ‘list_for_each_entry’
    |   95 |         list_for_each_entry(stream, &chip->stream_list, list) {
    |      |         ^~~~~~~~~~~~~~~~~~~
    |
  ‘acp_irq_handler’: events 6-9
    |
    |   96 |                 if (ext_intr_stat & stream->irq_bit) {
    |      |                                     ~~~~~~^~~~~~~~~
    |      |                                           |
    |      |                                           (6) ...to here
    |......
    |  102 |                 if (chip->rsrc->no_of_ctrls == 2) {
    |      |                    ~                       
    |      |                    |
    |      |                    (7) following ‘true’ branch...
    |  103 |                         if (ext_intr_stat1 & stream->irq_bit) {
    |      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    |      |                                            |       |
    |      |                                            |       (8) ...to here
    |      |                                            (9) use of uninitialized value ‘ext_intr_stat1’ here
    |
sound/soc/amd/acp/acp-legacy-common.c: In function ‘check_acp_config’:
sound/soc/amd/acp/acp-legacy-common.c:584:27: error: use of uninitialized value ‘pdm_addr’ [CWE-457] [-Werror=analyzer-use-of-uninitialized-value]
  584 |                 pdm_dev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), pdm_addr, 0);
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ‘check_acp_config’: events 1-7
    |
    |  559 |         u32 pdm_addr, ret;
    |      |             ^~~~~~~~
    |      |             |
    |      |             (1) region created on stack here
    |      |             (2) capacity: 4 bytes
    |  560 | 
    |  561 |         switch (chip->acp_rev) {
    |      |         ~~~~~~
    |      |         |
    |      |         (3) following ‘default:’ branch...
    |......
    |  583 |         if (chip->is_pdm_config) {
    |      |            ~~~~~~~~~~~~~~~~~~~~
    |      |            |    |
    |      |            |    (4) ...to here
    |      |            (5) following ‘true’ branch...
    |  584 |                 pdm_dev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), pdm_addr, 0);
    |      |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    |      |                           |
    |      |                           (6) ...to here
    |      |                           (7) use of uninitialized value ‘pdm_addr’ here
    |
cc1: all warnings being treated as errors
make[6]: *** [scripts/Makefile.build:203: sound/soc/amd/acp/acp-legacy-common.o] Error 1

@vijendarmukunda Could you take a look?

bardliao avatar Jun 03 '25 02:06 bardliao

@bardliao: will fix it

vijendarmukunda avatar Jun 03 '25 04:06 vijendarmukunda

@bardliao Fixed sparse check errors, patch got merged into Broonie git. Will check GCC static -fanalyzer reports and update.

Venkata-Prasad-Potturu avatar Jun 10 '25 05:06 Venkata-Prasad-Potturu

@bardliao Could you please add me into thesofproject group, I'm not receiving any emails.

Venkata-Prasad-Potturu avatar Jun 10 '25 06:06 Venkata-Prasad-Potturu

@bardliao Could you please add me into thesofproject group, I'm not receiving any emails.

Sure. And I will do a upstream merge after https://lore.kernel.org/linux-sound/[email protected]/T/#u is merged.

bardliao avatar Jun 10 '25 06:06 bardliao

@bardliao Could you please add me into thesofproject group, I'm not receiving any emails.

@Venkata-Prasad-Potturu Could you check if you got invited?

bardliao avatar Jun 10 '25 06:06 bardliao

@bardliao Yes, joined into the org. Thanks for the prompt response :).

Venkata-Prasad-Potturu avatar Jun 10 '25 06:06 Venkata-Prasad-Potturu

@Venkata-Prasad-Potturu I can still see below errors in the upstream merge PR (https://github.com/thesofproject/linux/pull/5463) Could you take a look?

https://github.com/thesofproject/linux/actions/runs/15747777751/job/44387192570?pr=5463

sound/soc/amd/acp/amd-acpi-mach.c:21:26: error: symbol 'snd_soc_acpi_amd_acp_machines' was not declared. Should it be static?
sound/soc/amd/acp/amd-acpi-mach.c:52:26: error: symbol 'snd_soc_acpi_amd_rmb_acp_machines' was not declared. Should it be static?
sound/soc/amd/acp/amd-acpi-mach.c:73:26: error: symbol 'snd_soc_acpi_amd_acp63_acp_machines' was not declared. Should it be static?
sound/soc/amd/acp/amd-acpi-mach.c:82:26: error: symbol 'snd_soc_acpi_amd_acp70_acp_machines' was not declared. Sho

https://github.com/thesofproject/linux/actions/runs/15747777751/job/44387192559?pr=5463

sound/soc/amd/acp/acp-legacy-common.c: In function ‘acp_irq_handler’:
sound/soc/amd/acp/acp-legacy-common.c:103:44: error: use of uninitialized value ‘ext_intr_stat1’ [CWE-457] [-Werror=analyzer-use-of-uninitialized-value]
  103 |                         if (ext_intr_stat1 & stream->irq_bit) {
      |                             ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
  ‘acp_irq_handler’: events 1-3
    |
    |   87 |         u32 ext_intr_stat, ext_intr_stat1;
    |      |                            ^~~~~~~~~~~~~~
    |      |                            |
    |      |                            (1) region created on stack here
    |      |                            (2) capacity: 4 bytes
    |   88 | 
    |   89 |         if (rsrc->no_of_ctrls == 2)
    |      |            ~                
    |      |            |
    |      |            (3) following ‘false’ branch...
    |
  ‘acp_irq_handler’: event 4
    |
    |sound/soc/amd/acp/chip_offset_byte.h:33:14:
    |   33 |         (chip->base + chip->rsrc->irq_reg_offset + offset + (ctrl * 0x04))
sound/soc/amd/acp/chip_offset_byte.h:37:44: note: in expansion of macro ‘ACP_EXTERNAL_INTR_REG_ADDR’
    |   37 | #define ACP_EXTERNAL_INTR_STAT(chip, ctrl) ACP_EXTERNAL_INTR_REG_ADDR(chip, \
    |      |                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/amd/acp/acp-legacy-common.c:92:31: note: in expansion of macro ‘ACP_EXTERNAL_INTR_STAT’
    |   92 |         ext_intr_stat = readl(ACP_EXTERNAL_INTR_STAT(chip, rsrc->irqp_used));
    |      |                               ^~~~~~~~~~~~~~~~~~~~~~
    |
  ‘acp_irq_handler’: event 5
    |
    |./include/linux/list.h:771:14:
    |  771 |              !list_entry_is_head(pos, head, member);                    \
    |      |              ^
    |      |              |
    |      |              (5) following ‘true’ branch...
sound/soc/amd/acp/acp-legacy-common.c:95:9: note: in expansion of macro ‘list_for_each_entry’
    |   95 |         list_for_each_entry(stream, &chip->stream_list, list) {
    |      |         ^~~~~~~~~~~~~~~~~~~
    |
  ‘acp_irq_handler’: events 6-9
    |
    |   96 |                 if (ext_intr_stat & stream->irq_bit) {
    |      |                                     ~~~~~~^~~~~~~~~
    |      |                                           |
    |      |                                           (6) ...to here
    |......
    |  102 |                 if (chip->rsrc->no_of_ctrls == 2) {
    |      |                    ~                       
    |      |                    |
    |      |                    (7) following ‘true’ branch...
    |  103 |                         if (ext_intr_stat1 & stream->irq_bit) {
    |      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    |      |                                            |       |
    |      |                                            |       (8) ...to here
    |      |                                            (9) use of uninitialized value ‘ext_intr_stat1’ here
    |
sound/soc/amd/acp/acp-legacy-common.c: In function ‘check_acp_config’:
sound/soc/amd/acp/acp-legacy-common.c:584:27: error: use of uninitialized value ‘pdm_addr’ [CWE-457] [-Werror=analyzer-use-of-uninitialized-value]
  584 |                 pdm_dev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), pdm_addr, 0);
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ‘check_acp_config’: events 1-7
    |
    |  559 |         u32 pdm_addr, ret;
    |      |             ^~~~~~~~
    |      |             |
    |      |             (1) region created on stack here
    |      |             (2) capacity: 4 bytes
    |  560 | 
    |  561 |         switch (chip->acp_rev) {
    |      |         ~~~~~~
    |      |         |
    |      |         (3) following ‘default:’ branch...
    |......
    |  583 |         if (chip->is_pdm_config) {
    |      |            ~~~~~~~~~~~~~~~~~~~~
    |      |            |    |
    |      |            |    (4) ...to here
    |      |            (5) following ‘true’ branch...
    |  584 |                 pdm_dev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), pdm_addr, 0);
    |      |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    |      |                           |
    |      |                           (6) ...to here
    |      |                           (7) use of uninitialized value ‘pdm_addr’ here
    |
cc1: all warnings being treated as errors
make[6]: *** [scripts/Makefile.build:287: sound/soc/amd/acp/acp-legacy-common.o] Error 1

bardliao avatar Jun 19 '25 06:06 bardliao

Hi @bardliao, Could you please double check the sparse errors. I'm unable to reproduce above mentioned errors with this patch (https://patchwork.kernel.org/project/alsa-devel/patch/[email protected]/).

I will check form my side as well.

Venkata-Prasad-Potturu avatar Jun 23 '25 11:06 Venkata-Prasad-Potturu