summaryrefslogtreecommitdiffstats
path: root/kernel/params.c
diff options
context:
space:
mode:
authorJonathan Cameron2011-04-19 13:43:47 +0200
committerRusty Russell2011-05-19 09:25:28 +0200
commitf721a465cddbe7f03e6cd2272008da558cf93818 (patch)
tree67cde95daa08e6e5967958f09e21f81140ce2e0b /kernel/params.c
parentdebugfs: move to new strtobool (diff)
downloadkernel-qcow2-linux-f721a465cddbe7f03e6cd2272008da558cf93818.tar.gz
kernel-qcow2-linux-f721a465cddbe7f03e6cd2272008da558cf93818.tar.xz
kernel-qcow2-linux-f721a465cddbe7f03e6cd2272008da558cf93818.zip
params.c: Use new strtobool function to process boolean inputs
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'kernel/params.c')
-rw-r--r--kernel/params.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/kernel/params.c b/kernel/params.c
index 28c5d5c83f6b..ed72e1330862 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -297,21 +297,15 @@ EXPORT_SYMBOL(param_ops_charp);
int param_set_bool(const char *val, const struct kernel_param *kp)
{
bool v;
+ int ret;
/* No equals means "set"... */
if (!val) val = "1";
/* One of =[yYnN01] */
- switch (val[0]) {
- case 'y': case 'Y': case '1':
- v = true;
- break;
- case 'n': case 'N': case '0':
- v = false;
- break;
- default:
- return -EINVAL;
- }
+ ret = strtobool(val, &v);
+ if (ret)
+ return ret;
if (kp->flags & KPARAM_ISBOOL)
*(bool *)kp->arg = v;