Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1158152

Re: kernel/params.c: 'err' variable "set but not used" and perhaps should be?

From Rusty Russell <rusty@rustcorp.com.au>
Newsgroups linux.kernel
Subject Re: kernel/params.c: 'err' variable "set but not used" and perhaps should be?
Date 2015-06-04 04:00 +0200
Message-ID <pxsBQ-2wB-5@gated-at.bofh.it> (permalink)
References <pxmPL-2wM-7@gated-at.bofh.it> <pxmPL-2wM-9@gated-at.bofh.it> <pxmPL-2wM-5@gated-at.bofh.it> <pxnsv-3z2-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Tejun Heo <htejun@gmail.com> writes:
>> > @@ -853,7 +853,8 @@ 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);
>> > +                       if (sysfs_create_file(&mk->kobj, &vattr->mattr.attr))
>> > +                               doesnt_happen();
>> >                        kobject_uevent(&mk->kobj, KOBJ_ADD);
>> >                        kobject_put(&mk->kobj);
>> >                }
>> 
>> Arguably then, the BUG_ON macro seems more appropriate for this situation
>> than this suggested doesnt_happen macro or my original offering of a call to
>> pr_warning.
>
> It does happen.  If you don't wanna roll back on failure, just wrap it
> in WARN_ON() so that there's at least some indication that something
> failed there?  It'd kinda suck to be missing some interface files w/o
> any indication, wouldn't it?

Please describe the circumstances under which this function can fail.

Thanks,
Rusty.
--
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 | Find similar | Unroll thread


Thread

Re: kernel/params.c: 'err' variable "set but not used" and perhaps should be? Rusty Russell <rusty@rustcorp.com.au> - 2015-06-04 04:00 +0200

csiph-web