mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 00:39:48 +00:00
ipmi_si: Use strstrip() to remove surrounding spaces
Instead of home grown analogue, use strstrip() from the kernel library. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Message-Id: <20210402174334.13466-9-andriy.shevchenko@linux.intel.com> Signed-off-by: Corey Minyard <cminyard@mvista.com>
This commit is contained in:
parent
2dafddb882
commit
d14ce8c770
1 changed files with 4 additions and 12 deletions
|
@ -185,24 +185,16 @@ static atomic_t hotmod_nr;
|
||||||
|
|
||||||
static int hotmod_handler(const char *val, const struct kernel_param *kp)
|
static int hotmod_handler(const char *val, const struct kernel_param *kp)
|
||||||
{
|
{
|
||||||
char *str = kstrdup(val, GFP_KERNEL), *curr, *next;
|
|
||||||
int rv;
|
int rv;
|
||||||
struct ipmi_plat_data h;
|
struct ipmi_plat_data h;
|
||||||
unsigned int len;
|
char *str, *curr, *next;
|
||||||
int ival;
|
|
||||||
|
|
||||||
|
str = kstrdup(val, GFP_KERNEL);
|
||||||
if (!str)
|
if (!str)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
/* Kill any trailing spaces, as we can get a "\n" from echo. */
|
/* Kill any trailing spaces, as we can get a "\n" from echo. */
|
||||||
len = strlen(str);
|
for (curr = strstrip(str); curr; curr = next) {
|
||||||
ival = len - 1;
|
|
||||||
while ((ival >= 0) && isspace(str[ival])) {
|
|
||||||
str[ival] = '\0';
|
|
||||||
ival--;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (curr = str; curr; curr = next) {
|
|
||||||
enum hotmod_op op;
|
enum hotmod_op op;
|
||||||
|
|
||||||
next = strchr(curr, ':');
|
next = strchr(curr, ':');
|
||||||
|
@ -235,7 +227,7 @@ static int hotmod_handler(const char *val, const struct kernel_param *kp)
|
||||||
put_device(dev);
|
put_device(dev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rv = len;
|
rv = strlen(val);
|
||||||
out:
|
out:
|
||||||
kfree(str);
|
kfree(str);
|
||||||
return rv;
|
return rv;
|
||||||
|
|
Loading…
Reference in a new issue