Re: [PATCH 6/6] test_hash.c: refactor into kunit

From: kernel test robot
Date: Thu Aug 26 2021 - 02:01:21 EST


Hi Isabella,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.14-rc7 next-20210825]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Isabella-Basso/test_hash-c-refactor-into-KUnit/20210826-092911
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 73f3af7b4611d77bdaea303fb639333eb28e37d7
config: m68k-randconfig-r013-20210826 (attached as .config)
compiler: m68k-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/89fe4c8eec63dcabd6d3e8f3f71f3c2248d18dab
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Isabella-Basso/test_hash-c-refactor-into-KUnit/20210826-092911
git checkout 89fe4c8eec63dcabd6d3e8f3f71f3c2248d18dab
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=m68k

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

lib/test_hash.c: In function 'test_int_hash32':
>> lib/test_hash.c:62:50: warning: passing argument 1 of '__hash_32_generic' makes integer from pointer without a cast [-Wint-conversion]
62 | hash_or[1][0] |= *h2 = __hash_32_generic(h0);
| ^~
| |
| u32 * {aka unsigned int *}
In file included from lib/test_hash.c:18:
include/linux/hash.h:60:41: note: expected 'u32' {aka 'unsigned int'} but argument is of type 'u32 *' {aka 'unsigned int *'}
60 | static inline u32 __hash_32_generic(u32 val)
| ~~~~^~~
lib/test_hash.c:68:1: error: no return statement in function returning non-void [-Werror=return-type]
68 | }
| ^
lib/test_hash.c: In function 'test_int_hash':
lib/test_hash.c:110:24: error: 'return' with a value, in function returning void [-Werror=return-type]
110 | return false;
| ^~~~~
lib/test_hash.c:97:13: note: declared here
97 | static void test_int_hash(struct kunit *test, unsigned long long h64)
| ^~~~~~~~~~~~~
cc1: some warnings being treated as errors


vim +/__hash_32_generic +62 lib/test_hash.c

468a9428521e7d00 George Spelvin 2016-05-26 58
7d8047a5cceb3123 Isabella Basso 2021-08-25 59 #ifdef HAVE_ARCH__HASH_32
89fe4c8eec63dcab Isabella Basso 2021-08-25 60 static bool test_int_hash32(struct kunit *test, u32 *h0, u32 *h1, u32 *h2)
7d8047a5cceb3123 Isabella Basso 2021-08-25 61 {
7d8047a5cceb3123 Isabella Basso 2021-08-25 @62 hash_or[1][0] |= *h2 = __hash_32_generic(h0);
7d8047a5cceb3123 Isabella Basso 2021-08-25 63 #if HAVE_ARCH__HASH_32 == 1
89fe4c8eec63dcab Isabella Basso 2021-08-25 64 KUNIT_ASSERT_EQ_MSG(test, *h1, *h2,
89fe4c8eec63dcab Isabella Basso 2021-08-25 65 "__hash_32(%#x) = %#x != __hash_32_generic() = %#x",
7d8047a5cceb3123 Isabella Basso 2021-08-25 66 *h0, *h1, *h2);
7d8047a5cceb3123 Isabella Basso 2021-08-25 67 #endif
7d8047a5cceb3123 Isabella Basso 2021-08-25 68 }
7d8047a5cceb3123 Isabella Basso 2021-08-25 69 #endif
7d8047a5cceb3123 Isabella Basso 2021-08-25 70

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip