mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-23 17:55:05 +03:00
camera: Fix v4l2-compliance test fails
Fix following test cases:
1.test invalid ioctls test
2.test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF
return proper error value from the driver.
Bug 4587577
Change-Id: Iee1114d4cc74ba27c3bef30190f936f69cbc32ac
Signed-off-by: Praveen AC <pac@nvidia.com>
(cherry picked from commit 7373b7bc0b)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3195935
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
5e61dccf81
commit
d2fcc70dca
@@ -692,16 +692,33 @@ tegra_channel_queue_setup(struct vb2_queue *vq,
|
|||||||
{
|
{
|
||||||
struct tegra_channel *chan = vb2_get_drv_priv(vq);
|
struct tegra_channel *chan = vb2_get_drv_priv(vq);
|
||||||
struct tegra_mc_vi *vi = chan->vi;
|
struct tegra_mc_vi *vi = chan->vi;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/* In some cases, if nplanes is valid
|
||||||
|
* and the requested image size is less than the
|
||||||
|
* actual image size, we need to return EINVAL.
|
||||||
|
* Previously, we were just updating sizes[0] irrespective
|
||||||
|
* of the requested image size. Although this did not harm the
|
||||||
|
* flow, according to "v4l2-compliance", we need to check if
|
||||||
|
* the requested size is invalid.
|
||||||
|
*/
|
||||||
|
if (*nplanes) {
|
||||||
|
if (sizes[0] < chan->format.sizeimage) {
|
||||||
|
dev_err(chan->vi->dev, "sizes[0] = %d chan->format.sizeimage = %d ...\n"
|
||||||
|
, sizes[0], chan->format.sizeimage);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sizes[0] = chan->format.sizeimage;
|
||||||
|
}
|
||||||
|
|
||||||
*nplanes = 1;
|
*nplanes = 1;
|
||||||
|
|
||||||
sizes[0] = chan->format.sizeimage;
|
|
||||||
alloc_devs[0] = tegra_channel_get_vi_unit(chan);
|
alloc_devs[0] = tegra_channel_get_vi_unit(chan);
|
||||||
|
|
||||||
if (vi->fops && vi->fops->vi_setup_queue)
|
if (vi->fops && vi->fops->vi_setup_queue)
|
||||||
return vi->fops->vi_setup_queue(chan, nbuffers);
|
return vi->fops->vi_setup_queue(chan, nbuffers);
|
||||||
else
|
return ret;
|
||||||
return -EINVAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int tegra_channel_alloc_buffer_queue(struct tegra_channel *chan,
|
int tegra_channel_alloc_buffer_queue(struct tegra_channel *chan,
|
||||||
@@ -2259,7 +2276,7 @@ static long tegra_channel_default_ioctl(struct file *file, void *fh,
|
|||||||
{
|
{
|
||||||
struct tegra_channel *chan = video_drvdata(file);
|
struct tegra_channel *chan = video_drvdata(file);
|
||||||
struct tegra_mc_vi *vi = chan->vi;
|
struct tegra_mc_vi *vi = chan->vi;
|
||||||
long ret = 0;
|
long ret = -ENOTTY;
|
||||||
|
|
||||||
if (vi->fops && vi->fops->vi_default_ioctl)
|
if (vi->fops && vi->fops->vi_default_ioctl)
|
||||||
ret = vi->fops->vi_default_ioctl(file, fh, use_prio, cmd, arg);
|
ret = vi->fops->vi_default_ioctl(file, fh, use_prio, cmd, arg);
|
||||||
|
|||||||
Reference in New Issue
Block a user