media: max9286: Fix enum_mbus_code
authorJacopo Mondi <jacopo.mondi@ideasonboard.com>
Mon, 17 Jun 2024 16:11:32 +0000 (18:11 +0200)
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Wed, 19 Jun 2024 16:43:05 +0000 (19:43 +0300)
The max9286 driver supports multiple output formats but only a single
one is reported through the .enum_mbus_code operation.

Fix that.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Link: https://lore.kernel.org/r/20240617161135.130719-10-jacopo.mondi@ideasonboard.com
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
drivers/media/i2c/max9286.c

index dfcb3fc033500eb19fc79a1f7e35e79193c115ab..46ce8e51c0111dc22b585e3f394e00d8bec2f030 100644 (file)
@@ -914,10 +914,10 @@ static int max9286_enum_mbus_code(struct v4l2_subdev *sd,
                                  struct v4l2_subdev_state *sd_state,
                                  struct v4l2_subdev_mbus_code_enum *code)
 {
-       if (code->pad || code->index > 0)
+       if (code->pad || code->index >= ARRAY_SIZE(max9286_formats))
                return -EINVAL;
 
-       code->code = MEDIA_BUS_FMT_UYVY8_1X16;
+       code->code = max9286_formats[code->index].code;
 
        return 0;
 }