public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Frederic Weisbecker <frederic@kernel.org>, linux-kernel@vger.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 1/1] kthread: Return the assigned value rather than 0
Date: Mon,  3 Feb 2025 18:48:55 +0200	[thread overview]
Message-ID: <20250203164855.3699026-1-andriy.shevchenko@linux.intel.com> (raw)

Recently introduced kthread_affine_preferred() has a bug that the value
of ret variable set but not used. This breaks the compilation with error
(assume default CONFIG_WERROR=y and `make W=1` to run the build):

kernel/kthread.c:862:6: error: variable 'ret' set but not used [-Werror,-Wunused-but-set-variable]

Fixes: 4d13f4304fa4 ("kthread: Implement preferred affinity")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 kernel/kthread.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/kthread.c b/kernel/kthread.c
index 4005b13ebd7f..8ab625e996d2 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -889,10 +889,12 @@ int kthread_affine_preferred(struct task_struct *p, const struct cpumask *mask)
 	raw_spin_unlock_irqrestore(&p->pi_lock, flags);
 
 	mutex_unlock(&kthreads_hotplug_lock);
+
+	ret = 0;
 out:
 	free_cpumask_var(affinity);
 
-	return 0;
+	return ret;
 }
 
 /*
-- 
2.43.0.rc1.1336.g36b5255a03ac


             reply	other threads:[~2025-02-03 16:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-03 16:48 Andy Shevchenko [this message]
2025-02-04  0:45 ` [PATCH v1 1/1] kthread: Return the assigned value rather than 0 Frederic Weisbecker
2025-02-04 14:28   ` Andy Shevchenko
2025-02-07 14:40     ` Andy Shevchenko
2025-02-07 18:32       ` Frederic Weisbecker
2025-02-07 19:02         ` Andy Shevchenko

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=20250203164855.3699026-1-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox