]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: omap3isp: isppreview: always clamp in preview_try_format()
authorHans Verkuil <hverkuil+cisco@kernel.org>
Tue, 7 Oct 2025 15:09:18 +0000 (17:09 +0200)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Tue, 6 Jan 2026 07:22:46 +0000 (08:22 +0100)
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>
drivers/media/platform/ti/omap3isp/isppreview.c

index 3e9e213c6d8ab98885068869d9eff2dbc5583063..3f3b5bd9cdc7ada39b0d9f10df18e9a0095a50da 100644 (file)
@@ -1742,22 +1742,17 @@ static void preview_try_format(struct isp_prev_device *prev,
 
        switch (pad) {
        case PREV_PAD_SINK:
-               /* When reading data from the CCDC, the input size has already
-                * been mangled by the CCDC output pad so it can be accepted
-                * as-is.
-                *
-                * When reading data from memory, clamp the requested width and
-                * height. The TRM doesn't specify a minimum input height, make
+               /*
+                * Clamp the requested width and height.
+                * The TRM doesn't specify a minimum input height, make
                 * sure we got enough lines to enable the noise filter and color
                 * filter array interpolation.
                 */
-               if (prev->input == PREVIEW_INPUT_MEMORY) {
-                       fmt->width = clamp_t(u32, fmt->width, PREV_MIN_IN_WIDTH,
-                                            preview_max_out_width(prev));
-                       fmt->height = clamp_t(u32, fmt->height,
-                                             PREV_MIN_IN_HEIGHT,
-                                             PREV_MAX_IN_HEIGHT);
-               }
+               fmt->width = clamp_t(u32, fmt->width, PREV_MIN_IN_WIDTH,
+                                    preview_max_out_width(prev));
+               fmt->height = clamp_t(u32, fmt->height,
+                                     PREV_MIN_IN_HEIGHT,
+                                     PREV_MAX_IN_HEIGHT);
 
                fmt->colorspace = V4L2_COLORSPACE_SRGB;