Skip to contentSkip to conversation

kthread: Return the assigned value rather than 0

PATCH In review Andy Shevchenko 2 participants 6 messages Feb 3, 2025 – Feb 7, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kthread: Return the assigned value rather than 0

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")
---
 kernel/kthread.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/kthread.c +3 -1
index 4005b13ebd7f..8ab625e996d2 100644
@@ -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;
 }
 
 /*
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
#1 lore raw
Quoted 8 lines · Andy Shevchenko

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

Thanks but I already have it queued there:

https://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git/commit/?h=kthread/fixes&id=1b0332a42656b798bea867631d739de023633ec6

I'll do a pull request shortly.

Thanks!

#2 lore raw
Quoted 7 lines · Frederic Weisbecker
Quoted 6 lines · Andy Shevchenko

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]

Quoted 8 lines
Quoted 2 lines
Fixes 4d13f4304fa4 ("kthread: Implement preferred affinity")

Thanks but I already have it queued there:

https://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git/commit/?h=kthread/fixes&id=1b0332a42656b798bea867631d739de023633ec6

I'll do a pull request shortly.

I'm fine with any approach as long as the issue will be fixed rather sooner.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
Quoted 11 lines · Andy Shevchenko
Quoted 10 lines · Frederic Weisbecker
Quoted 8 lines · Andy Shevchenko

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")
Quoted 7 lines
Quoted 5 lines

Thanks but I already have it queued there:

https://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git/commit/?h=kthread/fixes&id=1b0332a42656b798bea867631d739de023633ec6

I'll do a pull request shortly.

I'm fine with any approach as long as the issue will be fixed rather sooner.

Any news? As of today no appearance of the (alternative) fix either in upstream, or in Linux Next. What's the plan, please?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw

Hi Andy,

Quoted 14 lines · Andy Shevchenko
Quoted 13 lines · Andy Shevchenko
Quoted 12 lines · Frederic Weisbecker
Quoted 8 lines · Andy Shevchenko

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

Thanks but I already have it queued there:

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

https://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git/commit/?h=kthread/fixes&id=1b0332a42656b798bea867631d739de023633ec6

I'll do a pull request shortly.

I'm fine with any approach as long as the issue will be fixed rather sooner.

Any news? As of today no appearance of the (alternative) fix either in upstream, or in Linux Next. What's the plan, please?

It's there for a week or so. I must confess I should have advertized it:

1b0332a42656 ("kthread: Fix return value on kzalloc() failure in kthread_affine_preferred()")

Thanks.

#5 lore raw
Quoted 19 lines · Frederic Weisbecker
Quoted 18 lines · Andy Shevchenko
Quoted 17 lines · Andy Shevchenko
Quoted 15 lines · Frederic Weisbecker
Quoted 8 lines · Andy Shevchenko

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

Thanks but I already have it queued there:

https://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git/commit/?h=kthread/fixes&id=1b0332a42656b798bea867631d739de023633ec6

I'll do a pull request shortly.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

I'm fine with any approach as long as the issue will be fixed rather sooner.

Any news? As of today no appearance of the (alternative) fix either in upstream, or in Linux Next. What's the plan, please?

It's there for a week or so. I must confess I should have advertized it:

1b0332a42656 ("kthread: Fix return value on kzalloc() failure in kthread_affine_preferred()")

Thank you, I see it now!

Signature · 2 lines
With Best Regards,
Andy Shevchenko