Re: [igt-dev] [PATCH i-g-t 14/21] lib/igt_audio: Initialize freq in audio_signal_detect()

Paul Kocialkowski
2019-01-16T14:16:44Z

On Wed, 2019-01-16 at 13:20 +0200, Petri Latvala wrote:
> It's not clear to the static analyzer that freq is assigned when
> handling the previous frame and then used in the next. In fact, it
> wasn't clear to me either before staring at the code for some
> minutes. Initializing it to something makes both of us happier.
>
> Signed-off-by: Petri Latvala <petri.latvala@intel.com>
> Cc: Paul Kocialkowski <paul.kocialkowski@bootlin.com>

Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>

> ---
> lib/igt_audio.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/igt_audio.c b/lib/igt_audio.c
> index 229ce6c6..a0592d53 100644
> --- a/lib/igt_audio.c
> +++ b/lib/igt_audio.c
> @@ -250,7 +250,7 @@ bool audio_signal_detect(struct audio_signal *signal, int channels,
> int threshold;
> bool above;
> int error;
> - int freq;
> + int freq = 0;
> int max;
> int c, i, j;
>
--
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering