[linux-next:master 5739/6619] lib/kunit/kunit-test.c:565:25: warning: cast from 'void (*)(const void *)' to 'kunit_action_t *' (aka 'void (*)(void *)') converts to incompatible function type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   926f75c8a5ab70567eb4c2d82fbc96963313e564
commit: 05e2006ce493cb6fb5e5b4b8317f82754dfa2b1e [5739/6619] kunit: Use string_stream for test log
config: hexagon-buildonly-randconfig-r002-20221027 (https://download.01.org/0day-ci/archive/20230920/202309202345.yPRVHW8Q-lkp@xxxxxxxxx/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230920/202309202345.yPRVHW8Q-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309202345.yPRVHW8Q-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> lib/kunit/kunit-test.c:565:25: warning: cast from 'void (*)(const void *)' to 'kunit_action_t *' (aka 'void (*)(void *)') converts to incompatible function type [-Wcast-function-type-strict]
           kunit_add_action(test, (kunit_action_t *)kfree, full_log);
                                  ^~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.


vim +565 lib/kunit/kunit-test.c

   545	
   546	static void kunit_log_test(struct kunit *test)
   547	{
   548		struct kunit_suite suite;
   549	#ifdef CONFIG_KUNIT_DEBUGFS
   550		char *full_log;
   551	#endif
   552		suite.log = kunit_alloc_string_stream(test, GFP_KERNEL);
   553		KUNIT_ASSERT_NOT_ERR_OR_NULL(test, suite.log);
   554		string_stream_set_append_newlines(suite.log, true);
   555	
   556		kunit_log(KERN_INFO, test, "put this in log.");
   557		kunit_log(KERN_INFO, test, "this too.");
   558		kunit_log(KERN_INFO, &suite, "add to suite log.");
   559		kunit_log(KERN_INFO, &suite, "along with this.");
   560	
   561	#ifdef CONFIG_KUNIT_DEBUGFS
   562		KUNIT_EXPECT_TRUE(test, test->log->append_newlines);
   563	
   564		full_log = string_stream_get_string(test->log);
 > 565		kunit_add_action(test, (kunit_action_t *)kfree, full_log);
   566		KUNIT_EXPECT_NOT_ERR_OR_NULL(test,
   567					     strstr(full_log, "put this in log."));
   568		KUNIT_EXPECT_NOT_ERR_OR_NULL(test,
   569					     strstr(full_log, "this too."));
   570	
   571		full_log = string_stream_get_string(suite.log);
   572		kunit_add_action(test, kfree_wrapper, full_log);
   573		KUNIT_EXPECT_NOT_ERR_OR_NULL(test,
   574					     strstr(full_log, "add to suite log."));
   575		KUNIT_EXPECT_NOT_ERR_OR_NULL(test,
   576					     strstr(full_log, "along with this."));
   577	#else
   578		KUNIT_EXPECT_NULL(test, test->log);
   579	#endif
   580	}
   581	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux