Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: omap3isp: isppreview: always clamp in preview_try_format()

If prev->input != PREVIEW_INPUT_MEMORY the width and height weren't
clamped. Just always clamp.

This fixes a v4l2-compliance error:

fail: v4l2-test-subdevs.cpp(171): fse.max_width == ~0U || fse.max_height == ~0U
fail: v4l2-test-subdevs.cpp(270): ret && ret != ENOTTY
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: FAIL

Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>

+8 -13
+8 -13
drivers/media/platform/ti/omap3isp/isppreview.c
··· 1742 1742 1743 1743 switch (pad) { 1744 1744 case PREV_PAD_SINK: 1745 - /* When reading data from the CCDC, the input size has already 1746 - * been mangled by the CCDC output pad so it can be accepted 1747 - * as-is. 1748 - * 1749 - * When reading data from memory, clamp the requested width and 1750 - * height. The TRM doesn't specify a minimum input height, make 1745 + /* 1746 + * Clamp the requested width and height. 1747 + * The TRM doesn't specify a minimum input height, make 1751 1748 * sure we got enough lines to enable the noise filter and color 1752 1749 * filter array interpolation. 1753 1750 */ 1754 - if (prev->input == PREVIEW_INPUT_MEMORY) { 1755 - fmt->width = clamp_t(u32, fmt->width, PREV_MIN_IN_WIDTH, 1756 - preview_max_out_width(prev)); 1757 - fmt->height = clamp_t(u32, fmt->height, 1758 - PREV_MIN_IN_HEIGHT, 1759 - PREV_MAX_IN_HEIGHT); 1760 - } 1751 + fmt->width = clamp_t(u32, fmt->width, PREV_MIN_IN_WIDTH, 1752 + preview_max_out_width(prev)); 1753 + fmt->height = clamp_t(u32, fmt->height, 1754 + PREV_MIN_IN_HEIGHT, 1755 + PREV_MAX_IN_HEIGHT); 1761 1756 1762 1757 fmt->colorspace = V4L2_COLORSPACE_SRGB; 1763 1758