Commit 01812ba3 authored by Himanshu Jha's avatar Himanshu Jha Committed by Greg Kroah-Hartman

usb: isp1760: Use kasprintf

Use kasprintf instead of combination of kmalloc and sprintf and
therefore avoid unnecessary computation of string length.
Also, remove the useless local variable.
Signed-off-by: default avatarHimanshu Jha <himanshujha199640@gmail.com>
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 161c3bc3
...@@ -1441,7 +1441,6 @@ int isp1760_udc_register(struct isp1760_device *isp, int irq, ...@@ -1441,7 +1441,6 @@ int isp1760_udc_register(struct isp1760_device *isp, int irq,
unsigned long irqflags) unsigned long irqflags)
{ {
struct isp1760_udc *udc = &isp->udc; struct isp1760_udc *udc = &isp->udc;
const char *devname;
int ret; int ret;
udc->irq = -1; udc->irq = -1;
...@@ -1455,13 +1454,10 @@ int isp1760_udc_register(struct isp1760_device *isp, int irq, ...@@ -1455,13 +1454,10 @@ int isp1760_udc_register(struct isp1760_device *isp, int irq,
if (ret < 0) if (ret < 0)
return ret; return ret;
devname = dev_name(isp->dev); udc->irqname = kasprintf(GFP_KERNEL, "%s (udc)", dev_name(isp->dev));
udc->irqname = kmalloc(strlen(devname) + 7, GFP_KERNEL);
if (!udc->irqname) if (!udc->irqname)
return -ENOMEM; return -ENOMEM;
sprintf(udc->irqname, "%s (udc)", devname);
ret = request_irq(irq, isp1760_udc_irq, IRQF_SHARED | irqflags, ret = request_irq(irq, isp1760_udc_irq, IRQF_SHARED | irqflags,
udc->irqname, udc); udc->irqname, udc);
if (ret < 0) if (ret < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment