/* Allocate a circular buffer and all associated memory.  */
static struct pl2303_buf* pl2303_buf_alloc(unsigned int size)
/* Allocate a circular buffer and all associated memory.  */
static struct pl2303_buf* pl2303_buf_alloc(unsigned int size)
{
	struct pl2303_buf *pb;
	if (size == 0)
		return NULL;
	pb = kmalloc(sizeof(struct pl2303_buf), GFP_KERNEL);
	if (pb == NULL)
		return NULL;
	pb->buf_buf = kmalloc(size, GFP_KERNEL);
	if (pb->buf_buf == NULL) {
		kfree(pb);
		return NULL;
	}
	pb->buf_size = size;
	pb->buf_get = pb->buf_put = pb->buf_buf;
	return pb;
}