bcm27xx: switch to kernel v6.1
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.15 / 950-0278-media-i2c-tc358743-Only-allow-supported-pixel-fmts-i.patch
1 From fcdf09ccef256160d3d87a49a900fabff20286a4 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Fri, 10 Jul 2020 12:40:50 +0100
4 Subject: [PATCH] media: i2c: tc358743: Only allow supported pixel fmts
5 in set_fmt
6
7 Fix commit "media: tc358743: Return an appropriate colorspace from
8 tc358743_set_fmt" to ensure that the format passed in to set_fmt
9 is checked to be valid, and reset to the current format if not.
10
11 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
12 ---
13 drivers/media/i2c/tc358743.c | 6 ++++--
14 1 file changed, 4 insertions(+), 2 deletions(-)
15
16 --- a/drivers/media/i2c/tc358743.c
17 +++ b/drivers/media/i2c/tc358743.c
18 @@ -1731,8 +1731,10 @@ static int tc358743_set_fmt(struct v4l2_
19 u32 code = format->format.code; /* is overwritten by get_fmt */
20 int ret = tc358743_get_fmt(sd, sd_state, format);
21
22 - format->format.code = code;
23 - format->format.colorspace = tc358743_g_colorspace(code);
24 + if (code == MEDIA_BUS_FMT_RGB888_1X24 ||
25 + code == MEDIA_BUS_FMT_UYVY8_1X16)
26 + format->format.code = code;
27 + format->format.colorspace = tc358743_g_colorspace(format->format.code);
28
29 if (ret)
30 return ret;