Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1452394

Re: [PATCH] usb:serial: Add Fintek F81532/534 driver

From One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Newsgroups linux.kernel
Subject Re: [PATCH] usb:serial: Add Fintek F81532/534 driver
Date 2016-07-29 14:50 +0200
Message-ID <s0foJ-4Gb-9@gated-at.bofh.it> (permalink)
References <rEGOZ-3YM-5@gated-at.bofh.it>
Organization Intel Corporation

Show all headers | View raw


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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [PATCH] usb:serial: Add Fintek F81532/534 driver One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-07-29 14:50 +0200
  Re: [PATCH] usb:serial: Add Fintek F81532/534 driver "Ji-Ze Hong (Peter Hong)" <hpeter@gmail.com> - 2016-08-04 08:40 +0200

csiph-web