diff options
author | Himanshu Jha <himanshujha199640@gmail.com> | 2018-03-07 21:38:24 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-03-09 20:40:21 +0300 |
commit | 01812ba34a9a7756a46a54f25ba0f02e727ff35c (patch) | |
tree | 3fa4f80c0078d0eac963bfb1ca41d552fc2be68c /drivers/usb/isp1760 | |
parent | 161c3bc30f3a07458f91f15e35d5b2e91fa617cc (diff) | |
download | linux-01812ba34a9a7756a46a54f25ba0f02e727ff35c.tar.xz |
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: Himanshu Jha <himanshujha199640@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/isp1760')
-rw-r--r-- | drivers/usb/isp1760/isp1760-udc.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/usb/isp1760/isp1760-udc.c b/drivers/usb/isp1760/isp1760-udc.c index bac4ef5d9512..1714b2258b54 100644 --- a/drivers/usb/isp1760/isp1760-udc.c +++ b/drivers/usb/isp1760/isp1760-udc.c @@ -1441,7 +1441,6 @@ int isp1760_udc_register(struct isp1760_device *isp, int irq, unsigned long irqflags) { struct isp1760_udc *udc = &isp->udc; - const char *devname; int ret; udc->irq = -1; @@ -1455,13 +1454,10 @@ int isp1760_udc_register(struct isp1760_device *isp, int irq, if (ret < 0) return ret; - devname = dev_name(isp->dev); - udc->irqname = kmalloc(strlen(devname) + 7, GFP_KERNEL); + udc->irqname = kasprintf(GFP_KERNEL, "%s (udc)", dev_name(isp->dev)); 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) |