diff options
author | Juergen Gross <jgross@suse.com> | 2016-10-10 12:48:36 +0200 |
---|---|---|
committer | Felipe Balbi <felipe.balbi@linux.intel.com> | 2016-11-03 10:38:36 +0200 |
commit | 5002c93135947881f4f35caadf7292f40df7ef6b (patch) | |
tree | 151ae1927aa0efd58d2aa2d5c2dd2cf847167f32 /drivers | |
parent | bb0147364850c42db2a0dff5ef018e57413eaf79 (diff) | |
download | linux-5002c93135947881f4f35caadf7292f40df7ef6b.tar.bz2 |
usb: gadget: composite: use kasprintf() instead of open coding it
Let's not reimplement generic kernel helpers,
instead call kasprintf().
[ felipe.balbi@linux.intel.com: better commit log ]
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/gadget/composite.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 919d7d1b611c..41ab61f9b6e0 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -2387,18 +2387,8 @@ EXPORT_SYMBOL_GPL(usb_composite_setup_continue); static char *composite_default_mfr(struct usb_gadget *gadget) { - char *mfr; - int len; - - len = snprintf(NULL, 0, "%s %s with %s", init_utsname()->sysname, - init_utsname()->release, gadget->name); - len++; - mfr = kmalloc(len, GFP_KERNEL); - if (!mfr) - return NULL; - snprintf(mfr, len, "%s %s with %s", init_utsname()->sysname, - init_utsname()->release, gadget->name); - return mfr; + return kasprintf(GFP_KERNEL, "%s %s with %s", init_utsname()->sysname, + init_utsname()->release, gadget->name); } void usb_composite_overwrite_options(struct usb_composite_dev *cdev, |