if (*length > VINO_FRAMEBUFFER_MAX_COUNT) *length = VINO_FRAMEBUFFER_MAX_COUNT; 
if (*length > VINO_FRAMEBUFFER_COUNT_MAX) *length = VINO_FRAMEBUFFER_COUNT_MAX; 
static int vino_queue_init(struct vino_framebuffer_queue *q,			   unsigned int *length){	unsigned int i;	int ret = 0;	dprintk("vino_queue_init(): length = %d\n", *length);	if (q->magic == VINO_QUEUE_MAGIC) {		dprintk("vino_queue_init(): queue already initialized!\n");		return -EINVAL;	}	if (q->type != VINO_MEMORY_NONE) {		dprintk("vino_queue_init(): queue already initialized!\n");		return -EINVAL;	}	if (*length < 1)		return -EINVAL;	down(&q->queue_sem);	if (*length > VINO_FRAMEBUFFER_MAX_COUNT)		*length = VINO_FRAMEBUFFER_MAX_COUNT;	q->length = 0;	for (i = 0; i < *length; i++) {		dprintk("vino_queue_init(): allocating buffer %d\n", i);		q->buffer[i] = kmalloc(sizeof(struct vino_framebuffer),				       GFP_KERNEL);		if (!q->buffer[i]) {			dprintk("vino_queue_init(): kmalloc() failed\n");			ret = -ENOMEM;			break;		}		ret = vino_allocate_buffer(q->buffer[i],					   VINO_FRAMEBUFFER_SIZE);		if (ret) {			kfree(q->buffer[i]);			dprintk("vino_queue_init(): "				"vino_allocate_buffer() failed\n");			break;		}		q->buffer[i]->id = i;		if (i > 0) {			q->buffer[i]->offset = q->buffer[i - 1]->offset +				q->buffer[i - 1]->size;		} else {			q->buffer[i]->offset = 0;		}		spin_lock_init(&q->buffer[i]->state_lock);		dprintk("vino_queue_init(): buffer = %d, offset = %d, "			"size = %d\n", i, q->buffer[i]->offset,			q->buffer[i]->size);	}	if (ret) {		vino_queue_free_with_count(q, i);		*length = 0;	} else {		q->length = *length;		vino_fifo_init(&q->in, q->length);		vino_fifo_init(&q->out, q->length);		q->type = VINO_MEMORY_MMAP;		q->magic = VINO_QUEUE_MAGIC;	}	up(&q->queue_sem);	return ret;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/a637a114f36b94a1ad8b9867f43bac0414958420/vino.c/buggy/drivers/media/video/vino.c