linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [v2] selftests: powerpc: Remove unneeded variables
@ 2021-04-12 12:57 Wan Jiabing
  2021-05-17  5:57 ` Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: Wan Jiabing @ 2021-04-12 12:57 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Shuah Khan, Jordan Niethe, Michael Neuling, Wan Jiabing,
	linuxppc-dev, linux-kselftest, linux-kernel
  Cc: kael_w

Fix coccicheck warning:

./tools/testing/selftests/powerpc/alignment/alignment_handler.c:539:5-7:
Unneeded variable: "rc". Return "0" on line 562
./tools/testing/selftests/powerpc/alignment/alignment_handler.c:567:5-7:
Unneeded variable: "rc". Return "0" on line 580
./tools/testing/selftests/powerpc/alignment/alignment_handler.c:585:5-7:
Unneeded variable: "rc". Return "0" on line 594
./tools/testing/selftests/powerpc/alignment/alignment_handler.c:600:5-7:
Unneeded variable: "rc". Return "0" on line 611
./tools/testing/selftests/powerpc/alignment/alignment_handler.c:416:5-7:
Unneeded variable: "rc". Return "0" on line 470
./tools/testing/selftests/powerpc/alignment/alignment_handler.c:475:5-7:
Unneeded variable: "rc". Return "0" on line 485
./tools/testing/selftests/powerpc/alignment/alignment_handler.c:490:5-7:
Unneeded variable: "rc". Return "0" on line 506
./tools/testing/selftests/powerpc/alignment/alignment_handler.c:511:5-7:
Unneeded variable: "rc". Return "0" on line 534
./tools/testing/selftests/powerpc/alignment/alignment_handler.c:331:5-7:
Unneeded variable: "rc". Return "0" on line 344
./tools/testing/selftests/powerpc/alignment/alignment_handler.c:349:5-7:
Unneeded variable: "rc". Return "0" on line 360
./tools/testing/selftests/powerpc/alignment/alignment_handler.c:365:5-7:
Unneeded variable: "rc". Return "0" on line 392
./tools/testing/selftests/powerpc/alignment/alignment_handler.c:397:5-7:
Unneeded variable: "rc". Return "0" on line 411

Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
---
Changelog:
v2:
- Modify the subject line.
---
 .../powerpc/alignment/alignment_handler.c     | 48 +++++--------------
 1 file changed, 12 insertions(+), 36 deletions(-)

diff --git a/tools/testing/selftests/powerpc/alignment/alignment_handler.c b/tools/testing/selftests/powerpc/alignment/alignment_handler.c
index c25cf7cd45e9..48bfb7b36d84 100644
--- a/tools/testing/selftests/powerpc/alignment/alignment_handler.c
+++ b/tools/testing/selftests/powerpc/alignment/alignment_handler.c
@@ -328,8 +328,6 @@ static bool can_open_cifile(void)
 
 int test_alignment_handler_vsx_206(void)
 {
-	int rc = 0;
-
 	SKIP_IF(!can_open_cifile());
 	SKIP_IF(!have_hwcap(PPC_FEATURE_ARCH_2_06));
 
@@ -341,13 +339,11 @@ int test_alignment_handler_vsx_206(void)
 	STORE_VSX_XFORM_TEST(stxvd2x);
 	STORE_VSX_XFORM_TEST(stxvw4x);
 	STORE_VSX_XFORM_TEST(stxsdx);
-	return rc;
+	return 0;
 }
 
 int test_alignment_handler_vsx_207(void)
 {
-	int rc = 0;
-
 	SKIP_IF(!can_open_cifile());
 	SKIP_IF(!have_hwcap2(PPC_FEATURE2_ARCH_2_07));
 
@@ -357,13 +353,11 @@ int test_alignment_handler_vsx_207(void)
 	LOAD_VSX_XFORM_TEST(lxsiwzx);
 	STORE_VSX_XFORM_TEST(stxsspx);
 	STORE_VSX_XFORM_TEST(stxsiwx);
-	return rc;
+	return 0;
 }
 
 int test_alignment_handler_vsx_300(void)
 {
-	int rc = 0;
-
 	SKIP_IF(!can_open_cifile());
 
 	SKIP_IF(!have_hwcap2(PPC_FEATURE2_ARCH_3_00));
@@ -389,13 +383,11 @@ int test_alignment_handler_vsx_300(void)
 	STORE_VSX_XFORM_TEST(stxvx);
 	STORE_VSX_XFORM_TEST(stxvl);
 	STORE_VSX_XFORM_TEST(stxvll);
-	return rc;
+	return 0;
 }
 
 int test_alignment_handler_vsx_prefix(void)
 {
-	int rc = 0;
-
 	SKIP_IF(!can_open_cifile());
 	SKIP_IF(!have_hwcap2(PPC_FEATURE2_ARCH_3_1));
 
@@ -408,13 +400,11 @@ int test_alignment_handler_vsx_prefix(void)
 	STORE_VSX_8LS_PREFIX_TEST(PSTXSSP, 0);
 	STORE_VSX_8LS_PREFIX_TEST(PSTXV0, 0);
 	STORE_VSX_8LS_PREFIX_TEST(PSTXV1, 1);
-	return rc;
+	return 0;
 }
 
 int test_alignment_handler_integer(void)
 {
-	int rc = 0;
-
 	SKIP_IF(!can_open_cifile());
 
 	printf("Integer\n");
@@ -467,13 +457,11 @@ int test_alignment_handler_integer(void)
 	STORE_DFORM_TEST(stmw);
 #endif
 
-	return rc;
+	return 0;
 }
 
 int test_alignment_handler_integer_206(void)
 {
-	int rc = 0;
-
 	SKIP_IF(!can_open_cifile());
 	SKIP_IF(!have_hwcap(PPC_FEATURE_ARCH_2_06));
 
@@ -482,13 +470,11 @@ int test_alignment_handler_integer_206(void)
 	LOAD_XFORM_TEST(ldbrx);
 	STORE_XFORM_TEST(stdbrx);
 
-	return rc;
+	return 0;
 }
 
 int test_alignment_handler_integer_prefix(void)
 {
-	int rc = 0;
-
 	SKIP_IF(!can_open_cifile());
 	SKIP_IF(!have_hwcap2(PPC_FEATURE2_ARCH_3_1));
 
@@ -503,13 +489,11 @@ int test_alignment_handler_integer_prefix(void)
 	STORE_MLS_PREFIX_TEST(PSTH);
 	STORE_MLS_PREFIX_TEST(PSTW);
 	STORE_8LS_PREFIX_TEST(PSTD);
-	return rc;
+	return 0;
 }
 
 int test_alignment_handler_vmx(void)
 {
-	int rc = 0;
-
 	SKIP_IF(!can_open_cifile());
 	SKIP_IF(!have_hwcap(PPC_FEATURE_HAS_ALTIVEC));
 
@@ -531,13 +515,11 @@ int test_alignment_handler_vmx(void)
 	STORE_VMX_XFORM_TEST(stvehx);
 	STORE_VMX_XFORM_TEST(stvewx);
 	STORE_VMX_XFORM_TEST(stvxl);
-	return rc;
+	return 0;
 }
 
 int test_alignment_handler_fp(void)
 {
-	int rc = 0;
-
 	SKIP_IF(!can_open_cifile());
 
 	printf("Floating point\n");
@@ -559,13 +541,11 @@ int test_alignment_handler_fp(void)
 	STORE_FLOAT_XFORM_TEST(stfsux);
 	STORE_FLOAT_XFORM_TEST(stfiwx);
 
-	return rc;
+	return 0;
 }
 
 int test_alignment_handler_fp_205(void)
 {
-	int rc = 0;
-
 	SKIP_IF(!can_open_cifile());
 	SKIP_IF(!have_hwcap(PPC_FEATURE_ARCH_2_05));
 
@@ -577,13 +557,11 @@ int test_alignment_handler_fp_205(void)
 	STORE_FLOAT_DFORM_TEST(stfdp);
 	STORE_FLOAT_XFORM_TEST(stfdpx);
 
-	return rc;
+	return 0;
 }
 
 int test_alignment_handler_fp_206(void)
 {
-	int rc = 0;
-
 	SKIP_IF(!can_open_cifile());
 	SKIP_IF(!have_hwcap(PPC_FEATURE_ARCH_2_06));
 
@@ -591,14 +569,12 @@ int test_alignment_handler_fp_206(void)
 
 	LOAD_FLOAT_XFORM_TEST(lfiwzx);
 
-	return rc;
+	return 0;
 }
 
 
 int test_alignment_handler_fp_prefix(void)
 {
-	int rc = 0;
-
 	SKIP_IF(!can_open_cifile());
 	SKIP_IF(!have_hwcap2(PPC_FEATURE2_ARCH_3_1));
 
@@ -608,7 +584,7 @@ int test_alignment_handler_fp_prefix(void)
 	LOAD_FLOAT_MLS_PREFIX_TEST(PLFD);
 	STORE_FLOAT_MLS_PREFIX_TEST(PSTFS);
 	STORE_FLOAT_MLS_PREFIX_TEST(PSTFD);
-	return rc;
+	return 0;
 }
 
 void usage(char *prog)
-- 
2.30.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] [v2] selftests: powerpc: Remove unneeded variables
  2021-04-12 12:57 [PATCH] [v2] selftests: powerpc: Remove unneeded variables Wan Jiabing
@ 2021-05-17  5:57 ` Michael Ellerman
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2021-05-17  5:57 UTC (permalink / raw)
  To: Wan Jiabing, Benjamin Herrenschmidt, Paul Mackerras, Shuah Khan,
	Jordan Niethe, Michael Neuling, Wan Jiabing, linuxppc-dev,
	linux-kselftest, linux-kernel
  Cc: kael_w

Wan Jiabing <wanjiabing@vivo.com> writes:
> Fix coccicheck warning:
>
> ./tools/testing/selftests/powerpc/alignment/alignment_handler.c:539:5-7:
> Unneeded variable: "rc". Return "0" on line 562
> ./tools/testing/selftests/powerpc/alignment/alignment_handler.c:567:5-7:
> Unneeded variable: "rc". Return "0" on line 580
> ./tools/testing/selftests/powerpc/alignment/alignment_handler.c:585:5-7:
> Unneeded variable: "rc". Return "0" on line 594
> ./tools/testing/selftests/powerpc/alignment/alignment_handler.c:600:5-7:
> Unneeded variable: "rc". Return "0" on line 611
> ./tools/testing/selftests/powerpc/alignment/alignment_handler.c:416:5-7:
> Unneeded variable: "rc". Return "0" on line 470
> ./tools/testing/selftests/powerpc/alignment/alignment_handler.c:475:5-7:
> Unneeded variable: "rc". Return "0" on line 485
> ./tools/testing/selftests/powerpc/alignment/alignment_handler.c:490:5-7:
> Unneeded variable: "rc". Return "0" on line 506
> ./tools/testing/selftests/powerpc/alignment/alignment_handler.c:511:5-7:
> Unneeded variable: "rc". Return "0" on line 534
> ./tools/testing/selftests/powerpc/alignment/alignment_handler.c:331:5-7:
> Unneeded variable: "rc". Return "0" on line 344
> ./tools/testing/selftests/powerpc/alignment/alignment_handler.c:349:5-7:
> Unneeded variable: "rc". Return "0" on line 360
> ./tools/testing/selftests/powerpc/alignment/alignment_handler.c:365:5-7:
> Unneeded variable: "rc". Return "0" on line 392
> ./tools/testing/selftests/powerpc/alignment/alignment_handler.c:397:5-7:
> Unneeded variable: "rc". Return "0" on line 411
>
> Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
> ---
> Changelog:
> v2:
> - Modify the subject line.
> ---
>  .../powerpc/alignment/alignment_handler.c     | 48 +++++--------------
>  1 file changed, 12 insertions(+), 36 deletions(-)

This breaks the build. Please don't send selftest patches you haven't
even build tested.

cheers


powerpc64le-linux-gnu-gcc -std=gnu99 -O2 -Wall -Werror -DGIT_VERSION='"v5.13-rc2-30-g0510571fcf78"' -I/linux/tools/testing/selftests/powerpc/include     alignment_handler.c ../harness.c ../utils.c  -o /output/kselftest/powerpc/alignment/alignment_handler
alignment_handler.c: In function 'test_alignment_handler_vsx_206':
alignment_handler.c:93:2: error: 'rc' undeclared (first use in this function)
   93 |  rc |= do_test(#name, test_##name)
      |  ^~
alignment_handler.c:106:33: note: in expansion of macro 'TEST'
  106 | #define LOAD_VSX_XFORM_TEST(op) TEST(op, op, stxvd2x, XFORM, 32, 32)
      |                                 ^~~~
alignment_handler.c:326:2: note: in expansion of macro 'LOAD_VSX_XFORM_TEST'
  326 |  LOAD_VSX_XFORM_TEST(lxvd2x);
      |  ^~~~~~~~~~~~~~~~~~~
alignment_handler.c:93:2: note: each undeclared identifier is reported only once for each function it appears in
   93 |  rc |= do_test(#name, test_##name)
      |  ^~
alignment_handler.c:106:33: note: in expansion of macro 'TEST'
  106 | #define LOAD_VSX_XFORM_TEST(op) TEST(op, op, stxvd2x, XFORM, 32, 32)
      |                                 ^~~~
alignment_handler.c:326:2: note: in expansion of macro 'LOAD_VSX_XFORM_TEST'
  326 |  LOAD_VSX_XFORM_TEST(lxvd2x);
      |  ^~~~~~~~~~~~~~~~~~~
alignment_handler.c: In function 'test_alignment_handler_vsx_207':
alignment_handler.c:93:2: error: 'rc' undeclared (first use in this function)
   93 |  rc |= do_test(#name, test_##name)
      |  ^~
alignment_handler.c:106:33: note: in expansion of macro 'TEST'
  106 | #define LOAD_VSX_XFORM_TEST(op) TEST(op, op, stxvd2x, XFORM, 32, 32)
      |                                 ^~~~
alignment_handler.c:342:2: note: in expansion of macro 'LOAD_VSX_XFORM_TEST'
  342 |  LOAD_VSX_XFORM_TEST(lxsspx);
      |  ^~~~~~~~~~~~~~~~~~~
alignment_handler.c: In function 'test_alignment_handler_vsx_300':
alignment_handler.c:93:2: error: 'rc' undeclared (first use in this function)
   93 |  rc |= do_test(#name, test_##name)
      |  ^~
alignment_handler.c:112:33: note: in expansion of macro 'TEST'
  112 | #define LOAD_VMX_DFORM_TEST(op) TEST(op, op, stxv, DFORM, 0, 32)
      |                                 ^~~~
alignment_handler.c:356:2: note: in expansion of macro 'LOAD_VMX_DFORM_TEST'
  356 |  LOAD_VMX_DFORM_TEST(lxsd);
      |  ^~~~~~~~~~~~~~~~~~~
alignment_handler.c: In function 'test_alignment_handler_vsx_prefix':
alignment_handler.c:104:2: error: 'rc' undeclared (first use in this function)
  104 |  rc |= do_test(#name, test_##name)
      |  ^~
alignment_handler.c:134:44: note: in expansion of macro 'TESTP'
  134 | #define LOAD_VSX_8LS_PREFIX_TEST(op, tail) TESTP(op, op, PSTXV ## tail, 0, 32)
      |                                            ^~~~~
alignment_handler.c:386:2: note: in expansion of macro 'LOAD_VSX_8LS_PREFIX_TEST'
  386 |  LOAD_VSX_8LS_PREFIX_TEST(PLXSD, 0);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~
alignment_handler.c: In function 'test_alignment_handler_integer':
alignment_handler.c:93:2: error: 'rc' undeclared (first use in this function)
   93 |  rc |= do_test(#name, test_##name)
      |  ^~
alignment_handler.c:117:29: note: in expansion of macro 'TEST'
  117 | #define LOAD_DFORM_TEST(op) TEST(op, op, std, DFORM, 31, 31)
      |                             ^~~~
alignment_handler.c:402:2: note: in expansion of macro 'LOAD_DFORM_TEST'
  402 |  LOAD_DFORM_TEST(lbz);
      |  ^~~~~~~~~~~~~~~
alignment_handler.c: In function 'test_alignment_handler_integer_206':
alignment_handler.c:93:2: error: 'rc' undeclared (first use in this function)
   93 |  rc |= do_test(#name, test_##name)
      |  ^~
alignment_handler.c:115:29: note: in expansion of macro 'TEST'
  115 | #define LOAD_XFORM_TEST(op) TEST(op, op, stdx, XFORM, 31, 31)
      |                             ^~~~
alignment_handler.c:461:2: note: in expansion of macro 'LOAD_XFORM_TEST'
  461 |  LOAD_XFORM_TEST(ldbrx);
      |  ^~~~~~~~~~~~~~~
alignment_handler.c: In function 'test_alignment_handler_integer_prefix':
alignment_handler.c:104:2: error: 'rc' undeclared (first use in this function)
  104 |  rc |= do_test(#name, test_##name)
      |  ^~
alignment_handler.c:125:34: note: in expansion of macro 'TESTP'
  125 | #define LOAD_MLS_PREFIX_TEST(op) TESTP(op, op, PSTD, 31, 31)
      |                                  ^~~~~
alignment_handler.c:473:2: note: in expansion of macro 'LOAD_MLS_PREFIX_TEST'
  473 |  LOAD_MLS_PREFIX_TEST(PLBZ);
      |  ^~~~~~~~~~~~~~~~~~~~
alignment_handler.c: In function 'test_alignment_handler_vmx':
alignment_handler.c:93:2: error: 'rc' undeclared (first use in this function)
   93 |  rc |= do_test(#name, test_##name)
      |  ^~
alignment_handler.c:110:33: note: in expansion of macro 'TEST'
  110 | #define LOAD_VMX_XFORM_TEST(op) TEST(op, op, stxvd2x, XFORM, 0, 32)
      |                                 ^~~~
alignment_handler.c:492:2: note: in expansion of macro 'LOAD_VMX_XFORM_TEST'
  492 |  LOAD_VMX_XFORM_TEST(lvx);
      |  ^~~~~~~~~~~~~~~~~~~
alignment_handler.c: In function 'test_alignment_handler_fp':
alignment_handler.c:93:2: error: 'rc' undeclared (first use in this function)
   93 |  rc |= do_test(#name, test_##name)
      |  ^~
alignment_handler.c:120:36: note: in expansion of macro 'TEST'
  120 | #define LOAD_FLOAT_DFORM_TEST(op)  TEST(op, op, stfd, DFORM, 0, 0)
      |                                    ^~~~
alignment_handler.c:517:2: note: in expansion of macro 'LOAD_FLOAT_DFORM_TEST'
  517 |  LOAD_FLOAT_DFORM_TEST(lfd);
      |  ^~~~~~~~~~~~~~~~~~~~~
alignment_handler.c: In function 'test_alignment_handler_fp_205':
alignment_handler.c:93:2: error: 'rc' undeclared (first use in this function)
   93 |  rc |= do_test(#name, test_##name)
      |  ^~
alignment_handler.c:120:36: note: in expansion of macro 'TEST'
  120 | #define LOAD_FLOAT_DFORM_TEST(op)  TEST(op, op, stfd, DFORM, 0, 0)
      |                                    ^~~~
alignment_handler.c:545:2: note: in expansion of macro 'LOAD_FLOAT_DFORM_TEST'
  545 |  LOAD_FLOAT_DFORM_TEST(lfdp);
      |  ^~~~~~~~~~~~~~~~~~~~~
alignment_handler.c: In function 'test_alignment_handler_fp_206':
alignment_handler.c:93:2: error: 'rc' undeclared (first use in this function)
   93 |  rc |= do_test(#name, test_##name)
      |  ^~
alignment_handler.c:122:36: note: in expansion of macro 'TEST'
  122 | #define LOAD_FLOAT_XFORM_TEST(op)  TEST(op, op, stfdx, XFORM, 0, 0)
      |                                    ^~~~
alignment_handler.c:561:2: note: in expansion of macro 'LOAD_FLOAT_XFORM_TEST'
  561 |  LOAD_FLOAT_XFORM_TEST(lfiwzx);
      |  ^~~~~~~~~~~~~~~~~~~~~
alignment_handler.c: In function 'test_alignment_handler_fp_prefix':
alignment_handler.c:93:2: error: 'rc' undeclared (first use in this function)
   93 |  rc |= do_test(#name, test_##name)
      |  ^~
alignment_handler.c:120:36: note: in expansion of macro 'TEST'
  120 | #define LOAD_FLOAT_DFORM_TEST(op)  TEST(op, op, stfd, DFORM, 0, 0)
      |                                    ^~~~
alignment_handler.c:573:2: note: in expansion of macro 'LOAD_FLOAT_DFORM_TEST'
  573 |  LOAD_FLOAT_DFORM_TEST(lfs);
      |  ^~~~~~~~~~~~~~~~~~~~~
make[2]: *** [../../lib.mk:144: /output/kselftest/powerpc/alignment/alignment_handler] Error 1
make[2]: Target 'all' not remade because of errors.
make[2]: Leaving directory '/linux/tools/testing/selftests/powerpc/alignment'
make[1]: *** [Makefile:41: alignment] Error 2
make[1]: Leaving directory '/linux/tools/testing/selftests/powerpc'
make: *** [Makefile:159: all] Error 2

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-17  5:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12 12:57 [PATCH] [v2] selftests: powerpc: Remove unneeded variables Wan Jiabing
2021-05-17  5:57 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).