summaryrefslogtreecommitdiff
path: root/drivers/char/ipmi/ipmi_si_hotmod.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/ipmi/ipmi_si_hotmod.c')
-rw-r--r--drivers/char/ipmi/ipmi_si_hotmod.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/char/ipmi/ipmi_si_hotmod.c b/drivers/char/ipmi/ipmi_si_hotmod.c
index 4fbb4e18bae2..6b12a83ccd4c 100644
--- a/drivers/char/ipmi/ipmi_si_hotmod.c
+++ b/drivers/char/ipmi/ipmi_si_hotmod.c
@@ -17,9 +17,8 @@
static int hotmod_handler(const char *val, const struct kernel_param *kp);
module_param_call(hotmod, hotmod_handler, NULL, NULL, 0200);
-MODULE_PARM_DESC(hotmod, "Add and remove interfaces. See"
- " Documentation/driver-api/ipmi.rst in the kernel sources for the"
- " gory details.");
+MODULE_PARM_DESC(hotmod,
+ "Add and remove interfaces. See Documentation/driver-api/ipmi.rst in the kernel sources for the gory details.");
/*
* Parms come in as <op1>[:op2[:op3...]]. ops are:
@@ -185,24 +184,16 @@ static atomic_t hotmod_nr;
static int hotmod_handler(const char *val, const struct kernel_param *kp)
{
- char *str = kstrdup(val, GFP_KERNEL), *curr, *next;
int rv;
struct ipmi_plat_data h;
- unsigned int len;
- int ival;
+ char *str, *curr, *next;
+ str = kstrdup(val, GFP_KERNEL);
if (!str)
return -ENOMEM;
/* Kill any trailing spaces, as we can get a "\n" from echo. */
- len = strlen(str);
- ival = len - 1;
- while ((ival >= 0) && isspace(str[ival])) {
- str[ival] = '\0';
- ival--;
- }
-
- for (curr = str; curr; curr = next) {
+ for (curr = strstrip(str); curr; curr = next) {
enum hotmod_op op;
next = strchr(curr, ':');
@@ -231,11 +222,10 @@ static int hotmod_handler(const char *val, const struct kernel_param *kp)
if (strcmp(pdev->name, "hotmod-ipmi-si") == 0)
platform_device_unregister(pdev);
}
- if (dev)
- put_device(dev);
+ put_device(dev);
}
}
- rv = len;
+ rv = strlen(val);
out:
kfree(str);
return rv;