public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: wuyonggang001@208suo.com
To: w@1wt.eu, shuah@kernel.org
Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] selftests/nolibc: Remove unneeded variable
Date: Wed, 14 Jun 2023 16:09:35 +0800	[thread overview]
Message-ID: <f964d3dbc6362c2cae56bdbdc05befea@208suo.com> (raw)
In-Reply-To: <20230614080240.48197-1-zhanglibing@cdjrlc.com>

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@208suo.com>
---
  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)

       reply	other threads:[~2023-06-14  8:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230614080240.48197-1-zhanglibing@cdjrlc.com>
2023-06-14  8:09 ` wuyonggang001 [this message]
2023-06-16  6:34   ` [PATCH] selftests/nolibc: Remove unneeded variable Zhangjin Wu

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=f964d3dbc6362c2cae56bdbdc05befea@208suo.com \
    --to=wuyonggang001@208suo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=w@1wt.eu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox