All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: kernel/kthread.c:861:13: warning: variable 'ret' set but not used
Date: Thu, 30 Jan 2025 15:16:27 +0800	[thread overview]
Message-ID: <202501301528.t0cZVbnq-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   72deda0abee6e705ae71a93f69f55e33be5bca5c
commit: 4d13f4304fa43471bfea101658a11feec7b28ac0 kthread: Implement preferred affinity
date:   3 weeks ago
config: csky-randconfig-r022-20220420 (https://download.01.org/0day-ci/archive/20250130/202501301528.t0cZVbnq-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 12.4.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250130/202501301528.t0cZVbnq-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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501301528.t0cZVbnq-lkp@intel.com/

All warnings (new ones prefixed by >>):

   kernel/kthread.c: In function 'kthread_affine_preferred':
>> kernel/kthread.c:861:13: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
     861 |         int ret;
         |             ^~~


vim +/ret +861 kernel/kthread.c

   855	
   856	int kthread_affine_preferred(struct task_struct *p, const struct cpumask *mask)
   857	{
   858		struct kthread *kthread = to_kthread(p);
   859		cpumask_var_t affinity;
   860		unsigned long flags;
 > 861		int ret;
   862	
   863		if (!wait_task_inactive(p, TASK_UNINTERRUPTIBLE) || kthread->started) {
   864			WARN_ON(1);
   865			return -EINVAL;
   866		}
   867	
   868		WARN_ON_ONCE(kthread->preferred_affinity);
   869	
   870		if (!zalloc_cpumask_var(&affinity, GFP_KERNEL))
   871			return -ENOMEM;
   872	
   873		kthread->preferred_affinity = kzalloc(sizeof(struct cpumask), GFP_KERNEL);
   874		if (!kthread->preferred_affinity) {
   875			ret = -ENOMEM;
   876			goto out;
   877		}
   878	
   879		mutex_lock(&kthreads_hotplug_lock);
   880		cpumask_copy(kthread->preferred_affinity, mask);
   881		WARN_ON_ONCE(!list_empty(&kthread->hotplug_node));
   882		list_add_tail(&kthread->hotplug_node, &kthreads_hotplug);
   883		kthread_fetch_affinity(kthread, affinity);
   884	
   885		/* It's safe because the task is inactive. */
   886		raw_spin_lock_irqsave(&p->pi_lock, flags);
   887		do_set_cpus_allowed(p, affinity);
   888		raw_spin_unlock_irqrestore(&p->pi_lock, flags);
   889	
   890		mutex_unlock(&kthreads_hotplug_lock);
   891	out:
   892		free_cpumask_var(affinity);
   893	
   894		return 0;
   895	}
   896	

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

             reply	other threads:[~2025-01-30  7:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-30  7:16 kernel test robot [this message]
2025-02-04  9:08 ` [PATCH] kthread: Fix build warning variable 'ret' set but not used Dhruva Gole
2025-02-04 15:15   ` Kees Cook
2025-02-04 15:50     ` Dhruva Gole
2025-02-04 16:09   ` [PATCH V2] " Dhruva Gole
2025-02-04 19:02     ` Frederic Weisbecker
2025-02-05  6:17       ` Dhruva Gole
2025-02-05 11:09         ` Frederic Weisbecker

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=202501301528.t0cZVbnq-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.