From: Bryan O'Donoghue Date: Thu, 29 Oct 2015 16:58:29 +0000 (+0000) Subject: greybus: audio-pcm: fix use of variable unitialized X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~1082 X-Git-Url: https://git.kernelconcepts.de/?p=karo-tx-linux.git;a=commitdiff_plain;h=8417f5e56c8d67371f1810dfa0d1871f0119e89d 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 Reviewed-by: Alex Elder Reviewed-by: Mark Greer Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/audio-pcm.c b/drivers/staging/greybus/audio-pcm.c index fa5e85dfc83b..e62152a7be9e 100644 --- a/drivers/staging/greybus/audio-pcm.c +++ b/drivers/staging/greybus/audio-pcm.c @@ -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;