lkml.org 
[lkml]   [2015]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 3/8] kernel/params.c: generalize bool_enable_only
Hello,

On Wed, Apr 22, 2015 at 02:55:06PM -0700, Luis R. Rodriguez wrote:
> +int param_set_bool_enable_only(const char *val, const struct kernel_param *kp)
> +{
> + int err = 0;
> + bool new_value;
> + bool orig_value = *(bool *)kp->arg;
> + struct kernel_param dummy_kp = *kp;
> +
> + dummy_kp.arg = &new_value;
> +
> + err = param_set_bool(val, &dummy_kp);
> + if (err)
> + return err;
> +
> + /* Don't let them unset it once it's set! */
> + if (!new_value && orig_value)
> + return -EROFS;

I know that this was moved from another place but as we're making it
generic now I'm a bit curious about -EROFS. Wouldn't -EINVAL be a
more conventional choice here?

Thanks.

--
tejun


\
 
 \ /
  Last update: 2015-04-23 18:01    [W:0.171 / U:1.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site