[igt-dev] [PATCH i-g-t] lib/tests/igt_audio: fix bad-function-cast warning

Simon Ser simon.ser at intel.com
Fri Jun 7 11:08:48 UTC 2019


Cast a variable instead of the return value of the function.

Signed-off-by: Simon Ser <simon.ser at intel.com>
---
 lib/tests/igt_audio.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/tests/igt_audio.c b/lib/tests/igt_audio.c
index 47e61adf74fe..eee4dd51f04c 100644
--- a/lib/tests/igt_audio.c
+++ b/lib/tests/igt_audio.c
@@ -65,11 +65,14 @@ static void test_signal_detect_noise(struct audio_signal *signal)
 	double buf[BUFFER_LEN];
 	bool ok;
 	size_t i;
+	long r;

 	/* Generate random samples between -1 and 1 */
 	srand(42);
-	for (i = 0; i < BUFFER_LEN; i++)
-		buf[i] = (double) random() / RAND_MAX * 2 - 1;
+	for (i = 0; i < BUFFER_LEN; i++) {
+		r = random();
+		buf[i] = (double) r / RAND_MAX * 2 - 1;
+	}

 	ok = audio_signal_detect(signal, SAMPLING_RATE, 0, buf, BUFFER_LEN);

--
2.21.0



More information about the igt-dev mailing list