Re: [RFC, 2.6] a simple FIFO implementation
From: Andrea Arcangeli
Date: Fri Sep 17 2004 - 11:22:56 EST
On Fri, Sep 17, 2004 at 05:48:35PM +0200, Stelian Pop wrote:
> + /* verify that size is a power of 2 */
> + newsize = 1;
> + while (newsize < size)
> + newsize <<= 1;
> + if (newsize != size)
> + return NULL;
I think you mean:
BUG_ON(size & (size-1));
;)
> + fifo = kmalloc(sizeof(struct kfifo), gfp_mask);
> + if (!fifo)
> + return NULL;
this could be ERR_PTR(-ENOMEM).
> + buffer = kmalloc(newsize, gfp_mask);
> + if (!buffer)
> + return NULL;
same here.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/