Skip to content

Commit feaa628

Browse files
marc-hbkv2019i
authored andcommitted
drivers: hda: insert an empty ";" statement before switch() labels
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> (cherry picked from commit f0fd9f1)
1 parent 3c58926 commit feaa628

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

drivers/dma/dma_intel_adsp_hda.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,17 +181,19 @@ int intel_adsp_hda_dma_host_reload(const struct device *dev, uint32_t channel,
181181
#endif
182182
switch (cfg->direction) {
183183
case HOST_TO_MEMORY:
184-
uint32_t rp = *DGBRP(cfg->base, cfg->regblock_size, channel);
185-
uint32_t next_rp = (rp + INTEL_HDA_MIN_FPI_INCREMENT_FOR_INTERRUPT) %
184+
; /* Only statements can be labeled in C, a declaration is not valid */
185+
const uint32_t rp = *DGBRP(cfg->base, cfg->regblock_size, channel);
186+
const uint32_t next_rp = (rp + INTEL_HDA_MIN_FPI_INCREMENT_FOR_INTERRUPT) %
186187
intel_adsp_hda_get_buffer_size(cfg->base, cfg->regblock_size, channel);
187188

188189
intel_adsp_hda_set_buffer_segment_ptr(cfg->base, cfg->regblock_size,
189190
channel, next_rp);
190191
intel_adsp_hda_enable_buffer_interrupt(cfg->base, cfg->regblock_size, channel);
191192
break;
192193
case MEMORY_TO_HOST:
193-
uint32_t wp = *DGBWP(cfg->base, cfg->regblock_size, channel);
194-
uint32_t next_wp = (wp + INTEL_HDA_MIN_FPI_INCREMENT_FOR_INTERRUPT) %
194+
;
195+
const uint32_t wp = *DGBWP(cfg->base, cfg->regblock_size, channel);
196+
const uint32_t next_wp = (wp + INTEL_HDA_MIN_FPI_INCREMENT_FOR_INTERRUPT) %
195197
intel_adsp_hda_get_buffer_size(cfg->base, cfg->regblock_size, channel);
196198

197199
intel_adsp_hda_set_buffer_segment_ptr(cfg->base, cfg->regblock_size,

0 commit comments

Comments
 (0)