Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1160187
| From | Tejun Heo <htejun@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] kernel/params.c: make use of unused but set variable |
| Date | 2015-06-08 02:10 +0200 |
| Message-ID | <pySNz-6Jc-5@gated-at.bofh.it> (permalink) |
| References | <pySNz-6Jc-7@gated-at.bofh.it> <pySNz-6Jc-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sun, Jun 07, 2015 at 05:54:30PM -0600, Louis Langholtz wrote:
> While Rusty Russell wants the return value of sysfs_create_file
> ignored, it's annotated '__must_check'. Tejun Heo made the annotaion
> and suggests just using BUG_ON(). Meanwhile the compiler warns that
> the 'err' variable is set but unused. This patch uses Tejun's
> suggestion. This eliminates the warning, satisfies the required check,
> and fails-fast with notice if sysfs_create_file actually ever fails
> (something that Rusty says should never happen when this code runs).
>
> Signed-off-by: Louis Langholtz <lou_langholtz@me.com>
> ---
>
> diff --git a/kernel/params.c b/kernel/params.c
> index a22d6a7..b04a752 100644
> --- a/kernel/params.c
> +++ b/kernel/params.c
> @@ -853,6 +853,7 @@ static void __init version_sysfs_builtin(void)
> mk = locate_module_kobject(vattr->module_name);
> if (mk) {
> err = sysfs_create_file(&mk->kobj, &vattr->mattr.attr);
> + BUG_ON(err);
Maybe BUG_ON(sysfs_create_file(...)); is simpler? Other than that,
Acked-by: Tejun Heo <tj@kernel.org>
Thanks.
--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
Re: [PATCH] kernel/params.c: make use of unused but set variable Tejun Heo <htejun@gmail.com> - 2015-06-08 02:10 +0200
Re: [PATCH] kernel/params.c: make use of unused but set variable Linus Torvalds <torvalds@linux-foundation.org> - 2015-06-08 02:20 +0200
Re: [PATCH] kernel/params.c: make use of unused but set variable Tejun Heo <htejun@gmail.com> - 2015-06-08 03:00 +0200
Re: [PATCH] kernel/params.c: make use of unused but set variable Tejun Heo <htejun@gmail.com> - 2015-06-11 04:00 +0200
Re: [PATCH] kernel/params.c: make use of unused but set variable Louis Langholtz <lou_langholtz@me.com> - 2015-06-12 05:20 +0200
Re: [PATCH] debug: Deprecate BUG_ON() use in new code, introduce CRASH_ON() Ingo Molnar <mingo@kernel.org> - 2015-06-08 13:30 +0200
Re: [PATCH] debug: Deprecate BUG_ON() use in new code, introduce CRASH_ON() Ingo Molnar <mingo@kernel.org> - 2015-06-08 13:30 +0200
Re: [PATCH] debug: Deprecate BUG_ON() use in new code, introduce CRASH_ON() Ingo Molnar <mingo@kernel.org> - 2015-06-08 21:40 +0200
Re: [PATCH] kernel/params.c: make use of unused but set variable Tejun Heo <htejun@gmail.com> - 2015-06-12 03:50 +0200
Re: [PATCH] kernel/params.c: make use of unused but set variable Tejun Heo <htejun@gmail.com> - 2015-06-16 22:00 +0200
Re: [PATCH] kernel/params.c: make use of unused but set variable Rusty Russell <rusty@rustcorp.com.au> - 2015-06-12 03:50 +0200
csiph-web