Re: [PATCH 1/3] snd-usb-6fire: Move DMA-buffer off of the stack

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 21 Jul 2020 08:48:51 +0200,
René Herman wrote:
> 
> snd-usb-fire currently fails its firmware load with "transfer buffer not dma
> capable". Move said buffer off of the stack.
> 
> Signed-off-by: René Herman <rene.herman@xxxxxxxxx>
> ---
>  firmware.c | 95 ++++++++++++++++++++++++++----------------------------
>  1 file changed, 46 insertions(+), 49 deletions(-)
> 
> diff --git a/firmware.c b/firmware.c
> index 69137c1..502653a 100644
> --- a/firmware.c
> +++ b/firmware.c
> @@ -355,63 +355,60 @@ static int usb6fire_fw_check(struct usb_interface *intf, const u8 *version)
>  
>  int usb6fire_fw_init(struct usb_interface *intf)
>  {
> -	int i;
> -	int ret;
>  	struct usb_device *device = interface_to_usbdev(intf);
> +	int ret, i;
> +
>  	/* buffer: 8 receiving bytes from device and
>  	 * sizeof(EP_W_MAX_PACKET_SIZE) bytes for non-const copy */
> -	u8 buffer[12];
> +	u8 *buffer = kmalloc(12, GFP_KERNEL);
> +
> +	if (!buffer)
> +		return -ENOMEM;
>  
>  	ret = usb6fire_fw_ezusb_read(device, 1, 0, buffer, 8);
>  	if (ret < 0) {
>  		dev_err(&intf->dev,
>  			"unable to receive device firmware state.\n");
> -		return ret;
> -	}
> -	if (buffer[0] != 0xeb || buffer[1] != 0xaa || buffer[2] != 0x55) {
> -		dev_err(&intf->dev,
> -			"unknown device firmware state received from device:");
> -		for (i = 0; i < 8; i++)
> -			printk(KERN_CONT "%02x ", buffer[i]);
> -		printk(KERN_CONT "\n");
> -		return -EIO;
> -	}

Could you rather change return with goto out (with ret variable set)?
In that way we can see what actually you changed more clearly.


thanks,

Takashi



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux