On Fri, 24 Jun 2011 14:19:27 -0600
Jonathan Corbet <cor...@lwn.net> wrote:

> Here's a little something I decided to hack on rather than addressing all
> the real work I have to do.

...and while I was looking at this code, I noticed one little curious
thing:

int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
{
/* ... */
        /* Finally, allocate buffers and video memory */
        ret = __vb2_queue_alloc(q, req->memory, num_buffers, num_planes,
                                plane_sizes);
        if (ret < 0) {
                dprintk(1, "Memory allocation failed with error: %d\n", ret);
                return ret;
        }

If you actually look at __vb2_queue_alloc(), it claims to return the
number of buffers actually allocated, and an inspection of the code bears
up that claim.  So it can never return a negative value.  Do you maybe
want "if (ret <= 0) {" there instead?  One assumes there will be few
drivers so accommodating as to work with zero buffers.

Thanks,

jon
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to