[PATCH] selftests/nolibc: Remove unneeded variable

From: wuyonggang001
Date: Wed Jun 14 2023 - 04:11:07 EST


Fix the following coccicheck warning:

tools/testing/selftests/nolibc/nolibc-test.c:646:5-8: Unneeded variable: "ret". Return "0"

Signed-off-by: Yonggang Wu <wuyonggang001@xxxxxxxxxx>
---
tools/testing/selftests/nolibc/nolibc-test.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
index 486334981e60..2b723354e085 100644
--- a/tools/testing/selftests/nolibc/nolibc-test.c
+++ b/tools/testing/selftests/nolibc/nolibc-test.c
@@ -546,7 +546,6 @@ int run_syscall(int min, int max)
int proc;
int test;
int tmp;
- int ret = 0;
void *p1, *p2;

/* <proc> indicates whether or not /proc is mounted */
@@ -632,18 +631,17 @@ int run_syscall(int min, int max)
CASE_TEST(syscall_noargs); EXPECT_SYSEQ(1, syscall(__NR_getpid), getpid()); break;
CASE_TEST(syscall_args); EXPECT_SYSER(1, syscall(__NR_statx, 0, NULL, 0, 0, NULL), -1, EFAULT); break;
case __LINE__:
- return ret; /* must be last */
+ return 0; /* must be last */
/* note: do not set any defaults so as to permit holes above */
}
}
- return ret;
+ return 0;
}

int run_stdlib(int min, int max)
{
int test;
int tmp;
- int ret = 0;
void *p1, *p2;

for (test = min; test >= 0 && test <= max; test++) {
@@ -726,11 +724,11 @@ int run_stdlib(int min, int max)
# warning "__SIZEOF_LONG__ is undefined"
#endif /* __SIZEOF_LONG__ */
case __LINE__:
- return ret; /* must be last */
+ return 0; /* must be last */
/* note: do not set any defaults so as to permit holes above */
}
}
- return ret;
+ return 0;
}

#define EXPECT_VFPRINTF(c, expected, fmt, ...) \
@@ -790,7 +788,6 @@ static int run_vfprintf(int min, int max)
{
int test;
int tmp;
- int ret = 0;
void *p1, *p2;

for (test = min; test >= 0 && test <= max; test++) {
@@ -810,11 +807,11 @@ static int run_vfprintf(int min, int max)
CASE_TEST(hex); EXPECT_VFPRINTF(1, "f", "%x", 0xf); break;
CASE_TEST(pointer); EXPECT_VFPRINTF(3, "0x1", "%p", (void *) 0x1); break;
case __LINE__:
- return ret; /* must be last */
+ return 0; /* must be last */
/* note: do not set any defaults so as to permit holes above */
}
}
- return ret;
+ return 0;
}

static int smash_stack(void)