* [PATCH v2 0/1] media: i2c: ov5648: Fix lockdep error
@ 2022-02-03 12:33 Hans de Goede
2022-02-03 12:33 ` [PATCH v2 1/1] " Hans de Goede
0 siblings, 1 reply; 2+ messages in thread
From: Hans de Goede @ 2022-02-03 12:33 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Sakari Ailus; +Cc: Hans de Goede, linux-media
Hi,
This patch seems to have fallen through the cracks, so I'm
resending it.
Regards,
Hans
Hans de Goede (1):
media: i2c: ov5648: Fix lockdep error
drivers/media/i2c/ov5648.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
--
2.33.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH v2 1/1] media: i2c: ov5648: Fix lockdep error
2022-02-03 12:33 [PATCH v2 0/1] media: i2c: ov5648: Fix lockdep error Hans de Goede
@ 2022-02-03 12:33 ` Hans de Goede
0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2022-02-03 12:33 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Sakari Ailus
Cc: Hans de Goede, linux-media, Paul Kocialkowski
ov5648_state_init() calls ov5648_state_mipi_configure() which uses
__v4l2_ctrl_s_ctrl[_int64](). This means that sensor->mutex (which
is also sensor->ctrls.handler.lock) must be locked before calling
ov5648_state_init().
ov5648_state_mipi_configure() is also used in other places where
the lock is already held so it cannot be changed itself.
Note this is based on an identical (tested) fix for the ov8865 driver,
this has only been compile-tested.
Cc: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
- Move the taking of the mutex to inside ov5648_state_init()
---
drivers/media/i2c/ov5648.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/ov5648.c b/drivers/media/i2c/ov5648.c
index 947d437ed0ef..01e22c535267 100644
--- a/drivers/media/i2c/ov5648.c
+++ b/drivers/media/i2c/ov5648.c
@@ -1778,8 +1778,14 @@ static int ov5648_state_configure(struct ov5648_sensor *sensor,
static int ov5648_state_init(struct ov5648_sensor *sensor)
{
- return ov5648_state_configure(sensor, &ov5648_modes[0],
- ov5648_mbus_codes[0]);
+ int ret;
+
+ mutex_lock(&sensor->mutex);
+ ret = ov5648_state_configure(sensor, &ov5648_modes[0],
+ ov5648_mbus_codes[0]);
+ mutex_unlock(&sensor->mutex);
+
+ return ret;
}
/* Sensor Base */
--
2.33.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-03 12:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-03 12:33 [PATCH v2 0/1] media: i2c: ov5648: Fix lockdep error Hans de Goede
2022-02-03 12:33 ` [PATCH v2 1/1] " Hans de Goede
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).