All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@codeaurora.org>
To: Amitkumar Karwar <amitkarwar@gmail.com>
Cc: linux-wireless@vger.kernel.org,
	Prameela Rani Garnepudi <prameela.j04cs@gmail.com>,
	Amitkumar Karwar <amit.karwar@redpinesignals.com>
Subject: Re: [v2 05/11] rsi: Remove unnecessary buffer allocation
Date: Thu, 11 May 2017 21:28:38 +0300	[thread overview]
Message-ID: <87fugbs0x5.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <1494336614-2107-6-git-send-email-amit.karwar@redpinesignals.com> (Amitkumar Karwar's message of "Tue, 9 May 2017 19:00:08 +0530")

Amitkumar Karwar <amitkarwar@gmail.com> writes:

> From: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
>
> In functions usb read register and usb write register, dynamic allocation
> of 4 bytes is used. This is removed as it is unncessary for local variable
> and for such small data.
>
> Signed-off-by: Prameela Rani Garnepudi <prameela.j04cs@gmail.com>
> Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
> ---
>  drivers/net/wireless/rsi/rsi_91x_usb.c | 18 ++++--------------
>  1 file changed, 4 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c
> index 73b01a8..8eb7407 100644
> --- a/drivers/net/wireless/rsi/rsi_91x_usb.c
> +++ b/drivers/net/wireless/rsi/rsi_91x_usb.c
> @@ -157,12 +157,8 @@ static int rsi_usb_reg_read(struct usb_device *usbdev,
>  			    u16 *value,
>  			    u16 len)
>  {
> -	u8 *buf;
> -	int status = -ENOMEM;
> -
> -	buf  = kmalloc(0x04, GFP_KERNEL);
> -	if (!buf)
> -		return status;
> +	u8 buf[4];
> +	int status;
>  
>  	status = usb_control_msg(usbdev,
>  				 usb_rcvctrlpipe(usbdev, 0),

Recently I got a patch to orinoco_usb which did exactly the opposite
(unless I'm missing something):

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git/commit/?id=2f6ae79cb04bb7f9b4be3f1c32b6fda35bf976bc

The documentation for usb_control_msg() does not mention anything if
it's possible to use stack memory, but AFAIU it's not possible to use
stack memory with DMA. Can anyone clarify?

-- 
Kalle Valo

  reply	other threads:[~2017-05-11 18:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-09 13:30 [v2 00/11] Firmware loading changes Amitkumar Karwar
2017-05-09 13:30 ` [v2 01/11] rsi: Rename file rsi_91x_pkt.c to rsi_91x_hal.c Amitkumar Karwar
2017-05-09 13:30 ` [v2 02/11] rsi: Changes to sdio reads and writes Amitkumar Karwar
2017-05-09 13:30 ` [v2 03/11] rsi: Changes in USB read and write operations Amitkumar Karwar
2017-05-09 13:30 ` [v2 04/11] rsi: use macros in USB specific code Amitkumar Karwar
2017-05-09 13:30 ` [v2 05/11] rsi: Remove unnecessary buffer allocation Amitkumar Karwar
2017-05-11 18:28   ` Kalle Valo [this message]
2017-05-12  8:28     ` Arend van Spriel
2017-05-16 10:06       ` amit karwar
2017-05-09 13:30 ` [v2 06/11] rsi: Handle usb multi-byte write failure case properly Amitkumar Karwar
2017-05-09 13:30 ` [v2 07/11] rsi: Add usb multi-byte read operation Amitkumar Karwar
2017-05-11 18:35   ` Kalle Valo
2017-05-16 10:08     ` amit karwar
2017-05-09 13:30 ` [v2 08/11] rsi: Add host interface operations as separate structure Amitkumar Karwar
2017-05-09 13:30 ` [v2 09/11] rsi: Add new host interface operations Amitkumar Karwar
2017-05-09 13:30 ` [v2 10/11] rsi: Add new firmware loading method Amitkumar Karwar
2017-05-12  8:45   ` Kalle Valo
2017-05-16 10:09     ` amit karwar
2017-05-09 13:30 ` [v2 11/11] rsi: Remove old " Amitkumar Karwar
2017-05-12  8:46   ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fugbs0x5.fsf@kamboji.qca.qualcomm.com \
    --to=kvalo@codeaurora.org \
    --cc=amit.karwar@redpinesignals.com \
    --cc=amitkarwar@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=prameela.j04cs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.