Web lists-archives.org

Re: Copy and paste error in em28xx_init_isoc




Hi Janne,

On Thu, 24 Apr 2008 20:40:32 +0200
Janne Grunau <janne-dvb@xxxxxxxxx> wrote:

> Hi,
> 
> attached patch fixes a copy and paste error in check of kzalloc return 
> value. The check block was copied from the previous allocation but the 
> variable wasn't exchanged.

Thanks for the patch.

> diff -r 64a50d51c60b linux/drivers/media/video/em28xx/em28xx-core.c
> --- a/linux/drivers/media/video/em28xx/em28xx-core.c	Wed Apr 23 13:57:47 2008 +0200
> +++ b/linux/drivers/media/video/em28xx/em28xx-core.c	Thu Apr 24 20:40:23 2008 +0200
> @@ -659,9 +659,9 @@ int em28xx_init_isoc(struct em28xx *dev,
>  
>  	dev->isoc_ctl.transfer_buffer = kzalloc(sizeof(void *)*num_bufs,
>  					      GFP_KERNEL);
> -	if (!dev->isoc_ctl.urb) {
> +	if (!dev->isoc_ctl.transfer_buffer) {

Yes, this is clearly a copy-and-paste error.

>  		em28xx_errdev("cannot allocate memory for usbtransfer\n");
> -		kfree(dev->isoc_ctl.urb);
> +		kfree(dev->isoc_ctl.transfer_buffer);

This, however, were right. isoc_ctl.urb is allocated, and should be freed.
However, transfer_buffer is NULL, so it doesn't need kfree.

Could you please re-generate the patch and send me again?

Cheers,
Mauro

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list