linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] profile: Remove unnecessary ‘0’ values from err
@ 2023-09-19  1:41 Li zeming
  2023-10-12  6:27 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Li zeming @ 2023-09-19  1:41 UTC (permalink / raw)
  To: linux-kernel; +Cc: Li zeming

err is assigned first, so it does not need to initialize the assignment.

Signed-off-by: Li zeming <zeming@nfschina.com>
---
 kernel/profile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/profile.c b/kernel/profile.c
index 8a77769bc4b4..87acc7a9d7e2 100644
--- a/kernel/profile.c
+++ b/kernel/profile.c
@@ -465,7 +465,7 @@ int __ref create_proc_profile(void)
 	enum cpuhp_state online_state;
 #endif
 
-	int err = 0;
+	int err;
 
 	if (!prof_on)
 		return 0;
-- 
2.18.2


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

* Re: [PATCH] profile: Remove unnecessary ‘0’ values from err
  2023-09-19  1:41 [PATCH] profile: Remove unnecessary ‘0’ values from err Li zeming
@ 2023-10-12  6:27 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2023-10-12  6:27 UTC (permalink / raw)
  To: oe-kbuild, Li zeming, linux-kernel; +Cc: lkp, oe-kbuild-all, Li zeming

Hi Li,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Li-zeming/profile-Remove-unnecessary-0-values-from-err/20230919-094202
base:   linus/master
patch link:    https://lore.kernel.org/r/20230919014126.8168-1-zeming%40nfschina.com
patch subject: [PATCH] profile: Remove unnecessary ‘0’ values from err
config: i386-randconfig-141-20230921 (https://download.01.org/0day-ci/archive/20231012/202310120931.henXte1M-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce: (https://download.01.org/0day-ci/archive/20231012/202310120931.henXte1M-lkp@intel.com/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@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202310120931.henXte1M-lkp@intel.com/

smatch warnings:
kernel/profile.c:491 create_proc_profile() error: uninitialized symbol 'err'.

vim +/err +491 kernel/profile.c

^1da177e4c3f41 Linus Torvalds            2005-04-16  467  
1997ab2b2a8d46 Li zeming                 2023-09-19  468  	int err;
^1da177e4c3f41 Linus Torvalds            2005-04-16  469  
^1da177e4c3f41 Linus Torvalds            2005-04-16  470  	if (!prof_on)
^1da177e4c3f41 Linus Torvalds            2005-04-16  471  		return 0;
e722d8daafb974 Sebastian Andrzej Siewior 2016-07-13  472  #ifdef CONFIG_SMP
e722d8daafb974 Sebastian Andrzej Siewior 2016-07-13  473  	err = cpuhp_setup_state(CPUHP_PROFILE_PREPARE, "PROFILE_PREPARE",
e722d8daafb974 Sebastian Andrzej Siewior 2016-07-13  474  				profile_prepare_cpu, profile_dead_cpu);
e722d8daafb974 Sebastian Andrzej Siewior 2016-07-13  475  	if (err)
e722d8daafb974 Sebastian Andrzej Siewior 2016-07-13  476  		return err;
c270a817196a93 Srivatsa S. Bhat          2014-03-11  477  
e722d8daafb974 Sebastian Andrzej Siewior 2016-07-13  478  	err = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "AP_PROFILE_ONLINE",
e722d8daafb974 Sebastian Andrzej Siewior 2016-07-13  479  				profile_online_cpu, NULL);
e722d8daafb974 Sebastian Andrzej Siewior 2016-07-13  480  	if (err < 0)
e722d8daafb974 Sebastian Andrzej Siewior 2016-07-13  481  		goto err_state_prep;
e722d8daafb974 Sebastian Andrzej Siewior 2016-07-13  482  	online_state = err;
e722d8daafb974 Sebastian Andrzej Siewior 2016-07-13  483  	err = 0;
e722d8daafb974 Sebastian Andrzej Siewior 2016-07-13  484  #endif

err is uninitialized on single processor systems.

c33fff0afbef4f Denis V. Lunev            2008-04-29  485  	entry = proc_create("profile", S_IWUSR | S_IRUGO,
97a32539b9568b Alexey Dobriyan           2020-02-03  486  			    NULL, &profile_proc_ops);
1ad82fd547c716 Paolo Ciarrocchi          2008-01-25  487  	if (!entry)
e722d8daafb974 Sebastian Andrzej Siewior 2016-07-13  488  		goto err_state_onl;
271a15eabe0945 David Howells             2013-04-12  489  	proc_set_size(entry, (1 + prof_len) * sizeof(atomic_t));
c270a817196a93 Srivatsa S. Bhat          2014-03-11  490  
e722d8daafb974 Sebastian Andrzej Siewior 2016-07-13 @491  	return err;

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


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

end of thread, other threads:[~2023-10-12  6:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-19  1:41 [PATCH] profile: Remove unnecessary ‘0’ values from err Li zeming
2023-10-12  6:27 ` Dan Carpenter

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).