mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-27 07:20:52 +07:00
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:
parent
bb01473648
commit
5002c93135
@ -2387,18 +2387,8 @@ EXPORT_SYMBOL_GPL(usb_composite_setup_continue);
|
|||||||
|
|
||||||
static char *composite_default_mfr(struct usb_gadget *gadget)
|
static char *composite_default_mfr(struct usb_gadget *gadget)
|
||||||
{
|
{
|
||||||
char *mfr;
|
return kasprintf(GFP_KERNEL, "%s %s with %s", init_utsname()->sysname,
|
||||||
int len;
|
init_utsname()->release, gadget->name);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void usb_composite_overwrite_options(struct usb_composite_dev *cdev,
|
void usb_composite_overwrite_options(struct usb_composite_dev *cdev,
|
||||||
|
Loading…
Reference in New Issue
Block a user