summaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorPekka Enberg <penberg@cs.helsinki.fi>2006-06-23 02:05:45 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-23 07:43:06 -0700
commit66f969d064e46e6690c3426e2af846e76fb80e83 (patch)
tree3a1ab9196b5811ec287969a36dee12911fbd22f1 /drivers/char
parent481fad483487ea967fe20bbc9e565d787f7bf20f (diff)
downloadtalos-obmc-linux-66f969d064e46e6690c3426e2af846e76fb80e83.tar.gz
talos-obmc-linux-66f969d064e46e6690c3426e2af846e76fb80e83.zip
[PATCH] ipmi: strstrip conversion
Switch an open-coded strstrip() to use the new API. Acked-by: Corey Minyard <minyard@acm.org> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/ipmi/ipmi_watchdog.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
index 2d11ddd99e55..8f8867170973 100644
--- a/drivers/char/ipmi/ipmi_watchdog.c
+++ b/drivers/char/ipmi/ipmi_watchdog.c
@@ -212,24 +212,16 @@ static int set_param_str(const char *val, struct kernel_param *kp)
{
action_fn fn = (action_fn) kp->arg;
int rv = 0;
- const char *end;
- char valcp[16];
- int len;
-
- /* Truncate leading and trailing spaces. */
- while (isspace(*val))
- val++;
- end = val + strlen(val) - 1;
- while ((end >= val) && isspace(*end))
- end--;
- len = end - val + 1;
- if (len > sizeof(valcp) - 1)
- return -EINVAL;
- memcpy(valcp, val, len);
- valcp[len] = '\0';
+ char *dup, *s;
+
+ dup = kstrdup(val, GFP_KERNEL);
+ if (!dup)
+ return -ENOMEM;
+
+ s = strstrip(dup);
down_read(&register_sem);
- rv = fn(valcp, NULL);
+ rv = fn(s, NULL);
if (rv)
goto out_unlock;
@@ -239,6 +231,7 @@ static int set_param_str(const char *val, struct kernel_param *kp)
out_unlock:
up_read(&register_sem);
+ kfree(dup);
return rv;
}
OpenPOWER on IntegriCloud