All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: i2c: ov5648: Fix lockdep error
@ 2021-11-25 20:31 Hans de Goede
  2021-11-26 10:08 ` Paul Kocialkowski
  0 siblings, 1 reply; 3+ messages in thread
From: Hans de Goede @ 2021-11-25 20:31 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +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>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/media/i2c/ov5648.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/i2c/ov5648.c b/drivers/media/i2c/ov5648.c
index 947d437ed0ef..9f24bdccf50f 100644
--- a/drivers/media/i2c/ov5648.c
+++ b/drivers/media/i2c/ov5648.c
@@ -2546,7 +2546,9 @@ static int ov5648_probe(struct i2c_client *client)
 	if (ret)
 		goto error_mutex;
 
+	mutex_lock(&sensor->mutex);
 	ret = ov5648_state_init(sensor);
+	mutex_unlock(&sensor->mutex);
 	if (ret)
 		goto error_ctrls;
 
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-26 11:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-25 20:31 [PATCH] media: i2c: ov5648: Fix lockdep error Hans de Goede
2021-11-26 10:08 ` Paul Kocialkowski
2021-11-26 11:04   ` Hans de Goede

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.