if (kbuf == NULL) { Err("Failed to allocate decompress table.\n"); return -ENOMEM; } 
static int pwc_allocate_buffers(struct pwc_device *pdev){	int i;	void *kbuf;	Trace(TRACE_MEMORY, ">> pwc_allocate_buffers(pdev = 0x%p)\n", pdev);	if (pdev == NULL)		return -ENXIO;		#ifdef PWC_MAGIC	if (pdev->magic != PWC_MAGIC) {		Err("allocate_buffers(): magic failed.\n");		return -ENXIO;	}#endif		/* Allocate Isochronous pipe buffers */	for (i = 0; i < MAX_ISO_BUFS; i++) {		if (pdev->sbuf[i].data == NULL) {			kbuf = kmalloc(ISO_BUFFER_SIZE, GFP_KERNEL);			if (kbuf == NULL) {				Err("Failed to allocate iso buffer %d.\n", i);				return -ENOMEM;			}			Trace(TRACE_MEMORY, "Allocated iso buffer at %p.\n", kbuf);			pdev->sbuf[i].data = kbuf;			memset(kbuf, 0, ISO_BUFFER_SIZE);		}	}	/* Allocate frame buffer structure */	if (pdev->fbuf == NULL) {		kbuf = kmalloc(default_fbufs * sizeof(struct pwc_frame_buf), GFP_KERNEL);		if (kbuf == NULL) {			Err("Failed to allocate frame buffer structure.\n");			return -ENOMEM;		}		Trace(TRACE_MEMORY, "Allocated frame buffer structure at %p.\n", kbuf);		pdev->fbuf = kbuf;		memset(kbuf, 0, default_fbufs * sizeof(struct pwc_frame_buf));	}	/* create frame buffers, and make circular ring */	for (i = 0; i < default_fbufs; i++) {		if (pdev->fbuf[i].data == NULL) {			kbuf = vmalloc(PWC_FRAME_SIZE); /* need vmalloc since frame buffer > 128K */			if (kbuf == NULL) {				Err("Failed to allocate frame buffer %d.\n", i);				return -ENOMEM;			}			Trace(TRACE_MEMORY, "Allocated frame buffer %d at %p.\n", i, kbuf);			pdev->fbuf[i].data = kbuf;			memset(kbuf, 128, PWC_FRAME_SIZE);		}	}		/* Allocate decompressor table space */	kbuf = NULL;	switch (pdev->type)	 {	  case 675:	  case 680:	  case 690:	  case 720:	  case 730:	  case 740:	  case 750:#if 0	  	    Trace(TRACE_MEMORY,"private_data(%zu)\n",sizeof(struct pwc_dec23_private));	    kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL);	/* Timon & Kiara */	    break;	  case 645:	  case 646:	    /* TODO & FIXME */	    kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL);	    break;#endif	 	;	 }	if (kbuf == NULL) {	   Err("Failed to allocate decompress table.\n");	   return -ENOMEM;	}	pdev->decompress_data = kbuf;		/* Allocate image buffer; double buffer for mmap() */	kbuf = rvmalloc(default_mbufs * pdev->len_per_image);	if (kbuf == NULL) {		Err("Failed to allocate image buffer(s). needed (%d)\n",default_mbufs * pdev->len_per_image);		return -ENOMEM;	}	Trace(TRACE_MEMORY, "Allocated image buffer at %p.\n", kbuf);	pdev->image_data = kbuf;	for (i = 0; i < default_mbufs; i++)		pdev->image_ptr[i] = kbuf + i * pdev->len_per_image;	for (; i < MAX_IMAGES; i++)		pdev->image_ptr[i] = NULL;	kbuf = NULL;	  	Trace(TRACE_MEMORY, "<< pwc_allocate_buffers()\n");	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/c0105338eb4e61e537ca34ae06921177cb6efcf0/pwc-if.c/clean/drivers/usb/media/pwc/pwc-if.c