[Sound-open-firmware] [PATCH] host: verify number of period > 0
Liam Girdwood
liam.r.girdwood at linux.intel.com
Wed Dec 13 22:18:36 CET 2017
Check number of periods is > 0 other wise return an error and emit some
trace.
Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
src/audio/host.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/audio/host.c b/src/audio/host.c
index b731dd6..8f09952 100644
--- a/src/audio/host.c
+++ b/src/audio/host.c
@@ -412,6 +412,12 @@ static int host_params(struct comp_dev *dev)
hd->period_count = cconfig->periods_source;
}
+ /* validate period count */
+ if (hd->period_count == 0) {
+ trace_host_error("eS0");
+ return -EINVAL;
+ }
+
/* calculate period size based on config */
hd->period_bytes = dev->frames * comp_frame_bytes(dev);
if (hd->period_bytes == 0) {
--
2.14.1
More information about the Sound-open-firmware
mailing list