Commit 8417f5e5 authored by Bryan O'Donoghue's avatar Bryan O'Donoghue Committed by Greg Kroah-Hartman

greybus: audio-pcm: fix use of variable unitialized

Compiling with clang shows that period_elapsed will be used as a branch
conditional unitialized whenever snd_dev->transfer_done <
runtime->period_size. Since stack can grow up/down as we proceed though
the call stack this should be fixed. This patch fixes by explicitly
initalizing period_elapsed to zero.
Signed-off-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: default avatarAlex Elder <elder@linaro.org>
Reviewed-by: default avatarMark Greer <mgreer@animalcreek.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent b3500072
...@@ -91,6 +91,7 @@ static void gb_pcm_work(struct work_struct *work) ...@@ -91,6 +91,7 @@ static void gb_pcm_work(struct work_struct *work)
frames = (len + (oldptr % stride)) / stride; frames = (len + (oldptr % stride)) / stride;
period_elapsed = 0;
snd_dev->transfer_done += frames; snd_dev->transfer_done += frames;
if (snd_dev->transfer_done >= runtime->period_size) { if (snd_dev->transfer_done >= runtime->period_size) {
snd_dev->transfer_done -= runtime->period_size; snd_dev->transfer_done -= runtime->period_size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment