Skip to content

Commit

Permalink
drivers: hda: insert an empty ";" statement before switch() labels
Browse files Browse the repository at this point in the history
Only statements can be labeled in C, a declaration is not valid. This is
an FAQ.

While compilers currently in use don't seem to care, the "sparse" static
analyzer complains loudly (and cryptically):

https://github.com/thesofproject/sof/actions/runs/6052920348/job/16427323549

```
drivers/dma/dma_intel_adsp_hda.c:190:17: error: typename in expression
drivers/dma/dma_intel_adsp_hda.c:190:26: error: Expected ; at end of stmt
drivers/dma/dma_intel_adsp_hda.c:190:26: error: got rp
```

Add an empty ";" statement after each label makes `sparse` and probably
others happy.

Also add missing `const` to constants for clarity.

Fixes commit a026370 ("drivers: hda: use interrupt for timing L1
exit on host DMA")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
  • Loading branch information
marc-hb authored and carlescufi committed Sep 4, 2023
1 parent 76e4cd9 commit f0fd9f1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions drivers/dma/dma_intel_adsp_hda.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,17 +187,19 @@ int intel_adsp_hda_dma_host_reload(const struct device *dev, uint32_t channel,
#endif
switch (cfg->direction) {
case HOST_TO_MEMORY:
uint32_t rp = *DGBRP(cfg->base, cfg->regblock_size, channel);
uint32_t next_rp = (rp + INTEL_HDA_MIN_FPI_INCREMENT_FOR_INTERRUPT) %
; /* Only statements can be labeled in C, a declaration is not valid */
const uint32_t rp = *DGBRP(cfg->base, cfg->regblock_size, channel);
const uint32_t next_rp = (rp + INTEL_HDA_MIN_FPI_INCREMENT_FOR_INTERRUPT) %
intel_adsp_hda_get_buffer_size(cfg->base, cfg->regblock_size, channel);

intel_adsp_hda_set_buffer_segment_ptr(cfg->base, cfg->regblock_size,
channel, next_rp);
intel_adsp_hda_enable_buffer_interrupt(cfg->base, cfg->regblock_size, channel);
break;
case MEMORY_TO_HOST:
uint32_t wp = *DGBWP(cfg->base, cfg->regblock_size, channel);
uint32_t next_wp = (wp + INTEL_HDA_MIN_FPI_INCREMENT_FOR_INTERRUPT) %
;
const uint32_t wp = *DGBWP(cfg->base, cfg->regblock_size, channel);
const uint32_t next_wp = (wp + INTEL_HDA_MIN_FPI_INCREMENT_FOR_INTERRUPT) %
intel_adsp_hda_get_buffer_size(cfg->base, cfg->regblock_size, channel);

intel_adsp_hda_set_buffer_segment_ptr(cfg->base, cfg->regblock_size,
Expand Down

0 comments on commit f0fd9f1

Please sign in to comment.