The return value of __vb2_queue_alloc()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 24 Jun 2011 14:19:27 -0600
Jonathan Corbet <corbet@xxxxxxx> 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux