Commit 7f166add authored by Andy Shevchenko's avatar Andy Shevchenko

platform/x86: wmi: Replace kmalloc + sprintf() with kasprintf()

kasprintf() does the job of two: kmalloc() and sprintf().
Replace two calls with one.
Reviewed-by: default avatarDarren Hart (VMware) <dvhart@infradead.org>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent 04e4e888
......@@ -933,12 +933,11 @@ static int wmi_dev_probe(struct device *dev)
goto probe_failure;
}
buf = kmalloc(strlen(wdriver->driver.name) + 5, GFP_KERNEL);
buf = kasprintf(GFP_KERNEL, "wmi/%s", wdriver->driver.name);
if (!buf) {
ret = -ENOMEM;
goto probe_string_failure;
}
sprintf(buf, "wmi/%s", wdriver->driver.name);
wblock->char_dev.minor = MISC_DYNAMIC_MINOR;
wblock->char_dev.name = buf;
wblock->char_dev.fops = &wmi_fops;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment