mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 00:00:00 -04:00
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: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Reviewed-by: Mark Greer <mgreer@animalcreek.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
b350007219
commit
8417f5e56c
1 changed files with 1 additions and 0 deletions
|
|
@ -91,6 +91,7 @@ static void gb_pcm_work(struct work_struct *work)
|
|||
|
||||
frames = (len + (oldptr % stride)) / stride;
|
||||
|
||||
period_elapsed = 0;
|
||||
snd_dev->transfer_done += frames;
|
||||
if (snd_dev->transfer_done >= runtime->period_size) {
|
||||
snd_dev->transfer_done -= runtime->period_size;
|
||||
|
|
|
|||
Loading…
Reference in a new issue