mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-08 15:04:45 +00:00
v4l2-subdev: Return -EOPNOTSUPP for unsupported pad type in call_get_frame_desc()
The `get_frame_desc()` operation should always be called on a source pad, which is indicated by the `MEDIA_PAD_FL_SOURCE` flag. This patch adds a check in `call_get_frame_desc()` to ensure that the `MEDIA_PAD_FL_SOURCE` flag is set for the pad before invoking `get_frame_desc()`. If the pad is not a source pad, the function will return an `-EOPNOTSUPP` error, signaling that the operation is not supported on non-source pads. Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
24ad2d1f77
commit
afdb1f1fef
@ -334,6 +334,11 @@ static int call_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
|
||||
unsigned int i;
|
||||
int ret;
|
||||
|
||||
#if defined(CONFIG_MEDIA_CONTROLLER)
|
||||
if (!(sd->entity.pads[pad].flags & MEDIA_PAD_FL_SOURCE))
|
||||
return -EOPNOTSUPP;
|
||||
#endif
|
||||
|
||||
memset(fd, 0, sizeof(*fd));
|
||||
|
||||
ret = sd->ops->pad->get_frame_desc(sd, pad, fd);
|
||||
|
Loading…
Reference in New Issue
Block a user