Re: [PATCH] usb: isp1760: Use kasprintf
On Wed, Mar 07, 2018 at 08:20:54PM +0200, Andy Shevchenko wrote: > On Wed, Mar 7, 2018 at 8:08 PM, Himanshu Jha >wrote: > > Use kasprintf instead of combination of kmalloc and sprintf and > > therefore avoid unnecessary computation of string length. > > > devname = dev_name(isp->dev); > > Do you still need this temporary variable? No. > > - udc->irqname = kmalloc(strlen(devname) + 7, GFP_KERNEL); > > + udc->irqname = kasprintf(GFP_KERNEL, "%s (udc)", devname); > > Perhaps > > devname -> dev_name(isp->dev) > > ? Oh, yes! Thanks for pointing that out. I will send v2 with the update! -- Thanks Himanshu Jha
Re: [PATCH] usb: isp1760: Use kasprintf
On Wed, Mar 07, 2018 at 08:20:54PM +0200, Andy Shevchenko wrote: > On Wed, Mar 7, 2018 at 8:08 PM, Himanshu Jha > wrote: > > Use kasprintf instead of combination of kmalloc and sprintf and > > therefore avoid unnecessary computation of string length. > > > devname = dev_name(isp->dev); > > Do you still need this temporary variable? No. > > - udc->irqname = kmalloc(strlen(devname) + 7, GFP_KERNEL); > > + udc->irqname = kasprintf(GFP_KERNEL, "%s (udc)", devname); > > Perhaps > > devname -> dev_name(isp->dev) > > ? Oh, yes! Thanks for pointing that out. I will send v2 with the update! -- Thanks Himanshu Jha
Re: [PATCH] usb: isp1760: Use kasprintf
On Wed, Mar 7, 2018 at 8:08 PM, Himanshu Jhawrote: > Use kasprintf instead of combination of kmalloc and sprintf and > therefore avoid unnecessary computation of string length. > devname = dev_name(isp->dev); Do you still need this temporary variable? > - udc->irqname = kmalloc(strlen(devname) + 7, GFP_KERNEL); > + udc->irqname = kasprintf(GFP_KERNEL, "%s (udc)", devname); Perhaps devname -> dev_name(isp->dev) ? -- With Best Regards, Andy Shevchenko
Re: [PATCH] usb: isp1760: Use kasprintf
On Wed, Mar 7, 2018 at 8:08 PM, Himanshu Jha wrote: > Use kasprintf instead of combination of kmalloc and sprintf and > therefore avoid unnecessary computation of string length. > devname = dev_name(isp->dev); Do you still need this temporary variable? > - udc->irqname = kmalloc(strlen(devname) + 7, GFP_KERNEL); > + udc->irqname = kasprintf(GFP_KERNEL, "%s (udc)", devname); Perhaps devname -> dev_name(isp->dev) ? -- With Best Regards, Andy Shevchenko