diff mbox

selftests/timers: make loop consistent with array size

Message ID 1503504425-22808-1-git-send-email-benjamin.gaignard@linaro.org
State Accepted
Commit 8f14e26b63b1b6c7c681409e9db1bbf054e00b32
Headers show

Commit Message

Benjamin Gaignard Aug. 23, 2017, 4:07 p.m. UTC
clocksource_list array is defined as char [10][30] so
to initialise it we only have to iterate 10 times.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>

---
 tools/testing/selftests/timers/clocksource-switch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.7.4

Comments

Shuah Aug. 25, 2017, 4:06 p.m. UTC | #1
On 08/23/2017 10:07 AM, Benjamin Gaignard wrote:
> clocksource_list array is defined as char [10][30] so

> to initialise it we only have to iterate 10 times.

> 

> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>

> ---

>  tools/testing/selftests/timers/clocksource-switch.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/tools/testing/selftests/timers/clocksource-switch.c b/tools/testing/selftests/timers/clocksource-switch.c

> index 5ff1653..56fbfc1 100644

> --- a/tools/testing/selftests/timers/clocksource-switch.c

> +++ b/tools/testing/selftests/timers/clocksource-switch.c

> @@ -61,7 +61,7 @@ int get_clocksources(char list[][30])

>  

>  	close(fd);

>  

> -	for (i = 0; i < 30; i++)

> +	for (i = 0; i < 10; i++)

>  		list[i][0] = '\0';

>  

>  	head = buf;

> 


Good catch. Thanks. Applied to linux-kselftest next for 4.14-rc1.

thanks,
-- Shuah
diff mbox

Patch

diff --git a/tools/testing/selftests/timers/clocksource-switch.c b/tools/testing/selftests/timers/clocksource-switch.c
index 5ff1653..56fbfc1 100644
--- a/tools/testing/selftests/timers/clocksource-switch.c
+++ b/tools/testing/selftests/timers/clocksource-switch.c
@@ -61,7 +61,7 @@  int get_clocksources(char list[][30])
 
 	close(fd);
 
-	for (i = 0; i < 30; i++)
+	for (i = 0; i < 10; i++)
 		list[i][0] = '\0';
 
 	head = buf;