lkml.org 
[lkml]   [2016]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] usb:serial: Add Fintek F81532/534 driver
O
> +static int f81534_set_normal_register(struct usb_device *dev, u16 reg, u8 data)
> +{
> + size_t count = F81534_USB_MAX_RETRY;
> + int status;
> + u8 *tmp;
> +
> + tmp = kmalloc(sizeof(u8), GFP_KERNEL);
> + if (!tmp)
> + return -ENOMEM;

You end up doing huge numbers of tiny allocation and frees in some of the
code paths. I think it would be better to allocate them at a higher level
as they are not that cheap on CPU time.

> +static int f81534_read_data(struct usb_serial *usbserial, u32 address,
> + size_t size, unsigned char *buf)
> +{

Is a particularly good example - you do 4 mallocs plus two per byte of
data.

Alan

\
 
 \ /
  Last update: 2016-07-29 15:21    [W:1.086 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site