84b1252e1b506d4fb3e404a6db5b780038819b67
[openwrt/staging/blogic.git] /
1 From cd239eeb0ed6bea434b88d38a5fd8a775f199144 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Sat, 12 Feb 2022 11:57:19 +0000
4 Subject: [PATCH] media: i2c: ov7251: Initialise current_mode during
5 probe
6
7 Initialise ov7251->current_mode during probe to avoid the issue
8 of a NULL dereference should get_frame_interval be called before
9 set_frame_interval or set_format.
10
11 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
12 ---
13 drivers/media/i2c/ov7251.c | 2 ++
14 1 file changed, 2 insertions(+)
15
16 --- a/drivers/media/i2c/ov7251.c
17 +++ b/drivers/media/i2c/ov7251.c
18 @@ -1529,6 +1529,8 @@ static int ov7251_probe(struct i2c_clien
19
20 mutex_init(&ov7251->lock);
21
22 + ov7251->current_mode = &ov7251_mode_info_data[0];
23 +
24 v4l2_ctrl_handler_init(&ov7251->ctrls, 9);
25 ov7251->ctrls.lock = &ov7251->lock;
26