mirror of https://github.com/thesofproject/sof.git
dai-zephyr: possible division-by-zero if max_block_count is zero
If the max_block_count attribute is zero, this may lead to division by zero error. Handle this explicitly but reporting error if max_block_count is zero. Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
This commit is contained in:
parent
fe83601406
commit
4a0443812b
|
@ -639,6 +639,11 @@ static int dai_playback_params(struct dai_data *dd, struct comp_dev *dev, uint32
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (!max_block_count) {
|
||||
comp_err(dev, "dai_playback_params(): invalid max-block-count of zero");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (max_block_count < period_count) {
|
||||
comp_dbg(dev, "dai_playback_params(): block count = %d not supported by DMA", period_count);
|
||||
buf_size = period_count * period_bytes;
|
||||
|
|
Loading…
Reference in New Issue