From: Himanshu Jha <himanshujha199640@gmail.com>
To: gregkh@linuxfoundation.org
Cc: felipe.balbi@linux.intel.com, johan@kernel.org,
keescook@chromium.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org,
Himanshu Jha <himanshujha199640@gmail.com>
Subject: usb: isp1760: Use kasprintf
Date: Wed, 7 Mar 2018 23:38:02 +0530 [thread overview]
Message-ID: <1520446082-12264-1-git-send-email-himanshujha199640@gmail.com> (raw)
Use kasprintf instead of combination of kmalloc and sprintf and
therefore avoid unnecessary computation of string length.
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
---
drivers/usb/isp1760/isp1760-udc.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/usb/isp1760/isp1760-udc.c b/drivers/usb/isp1760/isp1760-udc.c
index bac4ef5..c35b153 100644
--- a/drivers/usb/isp1760/isp1760-udc.c
+++ b/drivers/usb/isp1760/isp1760-udc.c
@@ -1456,12 +1456,10 @@ int isp1760_udc_register(struct isp1760_device *isp, int irq,
return ret;
devname = dev_name(isp->dev);
- udc->irqname = kmalloc(strlen(devname) + 7, GFP_KERNEL);
+ udc->irqname = kasprintf(GFP_KERNEL, "%s (udc)", devname);
if (!udc->irqname)
return -ENOMEM;
- sprintf(udc->irqname, "%s (udc)", devname);
-
ret = request_irq(irq, isp1760_udc_irq, IRQF_SHARED | irqflags,
udc->irqname, udc);
if (ret < 0)
next reply other threads:[~2018-03-07 18:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-07 18:08 Himanshu Jha [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-03-07 18:20 usb: isp1760: Use kasprintf Andy Shevchenko
2018-03-07 18:30 Himanshu Jha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1520446082-12264-1-git-send-email-himanshujha199640@gmail.com \
--to=himanshujha199640@gmail.com \
--cc=felipe.balbi@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).