e7836602c52776a81447067a10268fcc7f779f9c
[openwrt/staging/mans0n.git] /
1 From b443f3889a2f689c7f480211e12f17ddc3b483f8 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
5 fmts 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, cfg, 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;