input/vcd: fix a divide by zero bug in the analog-only case

When the input data exclusively contained analog data, then creation of
the submit buffer for logic data caused a division by zero. Fix the
create_feed() routine.
This commit is contained in:
Gerhard Sittig 2020-10-22 19:27:06 +02:00
parent ec30291701
commit 2cb4204c6f
1 changed files with 5 additions and 3 deletions

View File

@ -1096,9 +1096,11 @@ static void create_feeds(const struct sr_input *in)
inc = in->priv;
/* Create one feed for logic data. */
inc->unit_size = (inc->logic_count + 7) / 8;
inc->feed_logic = feed_queue_logic_alloc(in->sdi,
CHUNK_SIZE / inc->unit_size, inc->unit_size);
if (inc->logic_count) {
inc->unit_size = (inc->logic_count + 7) / 8;
inc->feed_logic = feed_queue_logic_alloc(in->sdi,
CHUNK_SIZE / inc->unit_size, inc->unit_size);
}
/* Create one feed per analog channel. */
for (l = inc->channels; l; l = l->next) {