9d7869af9ccc703fc05cfc17089a44271cc7b904
[openwrt/staging/blocktrron.git] /
1 From 72c25bbb761de2b2acd9f8b652d63e2a2f1caeed Mon Sep 17 00:00:00 2001
2 From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
3 Date: Mon, 11 Sep 2023 12:17:25 +0300
4 Subject: [PATCH] media: i2c: imx477: Fix locking in imx477_init_controls()
5
6 The driver does not lock the imx477 mutex when calling
7 imx477_set_framing_limits(), leading to:
8
9 WARNING: CPU: 3 PID: 426 at drivers/media/v4l2-core/v4l2-ctrls-api.c:934 __v4l2_ctrl_modify_range+0x1a0/0x210 [
10 videodev]
11
12 Fix this by taking the lock.
13
14 Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
15 ---
16 drivers/media/i2c/imx477.c | 4 ++++
17 1 file changed, 4 insertions(+)
18
19 --- a/drivers/media/i2c/imx477.c
20 +++ b/drivers/media/i2c/imx477.c
21 @@ -2069,9 +2069,13 @@ static int imx477_init_controls(struct i
22
23 imx477->sd.ctrl_handler = ctrl_hdlr;
24
25 + mutex_lock(&imx477->mutex);
26 +
27 /* Setup exposure and frame/line length limits. */
28 imx477_set_framing_limits(imx477);
29
30 + mutex_unlock(&imx477->mutex);
31 +
32 return 0;
33
34 error: