All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Peres <martin.peres@linux.intel.com>
To: Simon Ser <simon.ser@intel.com>, igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t 1/2] lib/igt_audio: add more assertions
Date: Mon, 27 May 2019 13:07:45 +0300	[thread overview]
Message-ID: <c6eb9394-5ade-cf9b-7a9a-0dc3397eba7e@linux.intel.com> (raw)
In-Reply-To: <20190523105632.29397-1-simon.ser@intel.com>



On 23/05/2019 13:56, Simon Ser wrote:
> - Make sure an audio signal isn't created with zero channels
> - Make sure each channel has at least one frequency when synthesizing
> 
> Signed-off-by: Simon Ser <simon.ser@intel.com>
> ---
>  lib/igt_audio.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/igt_audio.c b/lib/igt_audio.c
> index 376e04ba6ed6..1677dd09c029 100644
> --- a/lib/igt_audio.c
> +++ b/lib/igt_audio.c
> @@ -80,6 +80,7 @@ struct audio_signal *audio_signal_init(int channels, int sampling_rate)
>  {
>  	struct audio_signal *signal;
>  
> +	igt_assert(channels > 0);
>  	igt_assert(channels <= CHANNELS_MAX);
>  
>  	signal = malloc(sizeof(struct audio_signal));
> @@ -267,8 +268,10 @@ void audio_signal_fill(struct audio_signal *signal, double *buffer,
>  
>  	memset(buffer, 0, sizeof(double) * signal->channels * samples);
>  
> -	for (i = 0; i < signal->channels; i++)
> +	for (i = 0; i < signal->channels; i++) {
>  		freqs_per_channel[i] = audio_signal_count_freqs(signal, i);
> +		igt_assert(freqs_per_channel[i]);

IMO, adding > 0 would be clearer.

With this done, the series is:

Reviewed-by: Martin Peres <martin.peres@linux.intel.com>

> +	}
>  
>  	for (i = 0; i < signal->freqs_count; i++) {
>  		freq = &signal->freqs[i];
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-05-27 10:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-23 10:56 [igt-dev] [PATCH i-g-t 1/2] lib/igt_audio: add more assertions Simon Ser
2019-05-23 10:56 ` [igt-dev] [PATCH i-g-t 2/2] lib/igt_audio: use calloc instead of malloc + memset Simon Ser
2019-05-23 12:34 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] lib/igt_audio: add more assertions Patchwork
2019-05-24 14:19 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-05-27 10:07 ` Martin Peres [this message]
2019-05-27 10:22   ` [igt-dev] [PATCH i-g-t 1/2] " Ser, Simon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c6eb9394-5ade-cf9b-7a9a-0dc3397eba7e@linux.intel.com \
    --to=martin.peres@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=simon.ser@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.