aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/wmi.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2018-02-16 17:40:24 +0200
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2018-02-19 17:03:43 +0200
commit7f166addbebdcaeefe36997d5b8dceb96c5619fa (patch)
treed66206c1b447f0b842c0d684ce0a219432e0b0d1 /drivers/platform/x86/wmi.c
parentplatform/x86: intel_turbo_max_3: Remove restriction for HWP platforms (diff)
downloadlinux-dev-7f166addbebdcaeefe36997d5b8dceb96c5619fa.tar.xz
linux-dev-7f166addbebdcaeefe36997d5b8dceb96c5619fa.zip
platform/x86: wmi: Replace kmalloc + sprintf() with kasprintf()
kasprintf() does the job of two: kmalloc() and sprintf(). Replace two calls with one. Reviewed-by: Darren Hart (VMware) <dvhart@infradead.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to '')
-rw-r--r--drivers/platform/x86/wmi.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index c0c8945603cb..4e76ffcb5394 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -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;