diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2014-07-17 06:53:08 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-07-22 00:04:58 -0300 |
commit | 8a75ffb81b1c1b6949d191fbef3eaa03fd648852 (patch) | |
tree | d490a450f9f24662f8c345b2c0746d1dbaa0542a /drivers/hwmon/via-cputemp.c | |
parent | a54e0fee61a585956b4e9a97ae2605600e5c1c82 (diff) | |
download | linux-8a75ffb81b1c1b6949d191fbef3eaa03fd648852.tar.bz2 |
[media] vb2: fix bytesused == 0 handling
The original report from Nikhil was that if data_offset > 0 and bytesused == 0,
then the check in __verify_length() would fail, even though the spec says that
if bytes_used == 0, then it will be replaced by the actual length of the
buffer.
After digging into it a bit more I realized that there were several other
things wrong:
- in __verify_length() it would use the application-provided length value
for USERPTR and the vb2 core length for other memory models, but it
should have used the application-provided length as well for DMABUF.
- in __fill_vb2_buffer() on the other hand it would replace bytesused == 0
by the application-provided length, even for MMAP buffers where the
length is determined by the vb2 core.
- in __fill_vb2_buffer() it tries to figure out if all the planes have
bytesused == 0 before it will decide to replace bytesused by length.
However, the spec makes no such provision, and it makes for convoluted
code. So just replace any bytesused == 0 by the proper length.
The idea behind this was that you could use bytesused to signal empty
planes, something that is currently not supported. But that is better
done in the future by using one of the reserved fields in strucy v4l2_plane.
This patch fixes all these issues.
Regards,
Hans
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Cc: Nikhil Devshatwar <nikhil.nd@ti.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/hwmon/via-cputemp.c')
0 files changed, 0 insertions, 0 deletions