* [PATCH] usb/gadget: use kasprintf() instead of open coding it
@ 2016-10-10 10:17 Juergen Gross
2016-10-10 10:26 ` Felipe Balbi
0 siblings, 1 reply; 3+ messages in thread
From: Juergen Gross @ 2016-10-10 10:17 UTC (permalink / raw)
To: linux-kernel, linux-usb; +Cc: gregkh, balbi, Juergen Gross
Signed-off-by: Juergen Gross <jgross@suse.com>
---
drivers/usb/gadget/composite.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 32176f7..455efec 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -2382,18 +2382,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,
--
2.6.6
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] usb/gadget: use kasprintf() instead of open coding it
2016-10-10 10:17 [PATCH] usb/gadget: use kasprintf() instead of open coding it Juergen Gross
@ 2016-10-10 10:26 ` Felipe Balbi
2016-10-10 10:34 ` Juergen Gross
0 siblings, 1 reply; 3+ messages in thread
From: Felipe Balbi @ 2016-10-10 10:26 UTC (permalink / raw)
To: Juergen Gross, linux-kernel, linux-usb; +Cc: gregkh, Juergen Gross
[-- Attachment #1: Type: text/plain, Size: 1316 bytes --]
Hi,
Juergen Gross <jgross@suse.com> writes:
> Signed-off-by: Juergen Gross <jgross@suse.com>
I can't apply anything without a commit log. Sorry.
> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
> index 32176f7..455efec 100644
> --- a/drivers/usb/gadget/composite.c
> +++ b/drivers/usb/gadget/composite.c
> @@ -2382,18 +2382,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,
> --
> 2.6.6
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] usb/gadget: use kasprintf() instead of open coding it
2016-10-10 10:26 ` Felipe Balbi
@ 2016-10-10 10:34 ` Juergen Gross
0 siblings, 0 replies; 3+ messages in thread
From: Juergen Gross @ 2016-10-10 10:34 UTC (permalink / raw)
To: Felipe Balbi, linux-kernel, linux-usb; +Cc: gregkh
On 10/10/16 12:26, Felipe Balbi wrote:
>
> Hi,
>
> Juergen Gross <jgross@suse.com> writes:
>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>
> I can't apply anything without a commit log. Sorry.
I always thought a subject line telling the complete story would be
enough. I'll resend with the subject duplicated to the body.
Juergen
>
>> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
>> index 32176f7..455efec 100644
>> --- a/drivers/usb/gadget/composite.c
>> +++ b/drivers/usb/gadget/composite.c
>> @@ -2382,18 +2382,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,
>> --
>> 2.6.6
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-10-10 10:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-10 10:17 [PATCH] usb/gadget: use kasprintf() instead of open coding it Juergen Gross
2016-10-10 10:26 ` Felipe Balbi
2016-10-10 10:34 ` Juergen Gross
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox