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>
This commit is contained in:
Juergen Gross 2016-10-10 12:48:36 +02:00 committed by Felipe Balbi
parent bb01473648
commit 5002c93135
1 changed files with 2 additions and 12 deletions

View File

@ -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,