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>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3191238
Reviewed-by: Narendra Kondapalli <nkondapalli@nvidia.com>
Reviewed-by: Anubhav Rai <arai@nvidia.com>
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Praveen AC
2024-08-09 09:42:28 +00:00
committed by mobile promotions
parent 06c838e81c
commit 7373b7bc0b

View File

@@ -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) {
pr_err("%s: sizes[0] = %d chan->format.sizeimage = %d ...\n"
,__func__,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,
@@ -2256,7 +2273,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);