From: Hans de Goede <hdegoede@redhat.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Hans de Goede <hdegoede@redhat.com>,
linux-media@vger.kernel.org,
Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Subject: [PATCH] media: i2c: ov5648: Fix lockdep error
Date: Thu, 25 Nov 2021 21:31:56 +0100 [thread overview]
Message-ID: <20211125203156.825539-1-hdegoede@redhat.com> (raw)
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
next reply other threads:[~2021-11-25 20:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-25 20:31 Hans de Goede [this message]
2021-11-26 10:08 ` [PATCH] media: i2c: ov5648: Fix lockdep error Paul Kocialkowski
2021-11-26 11:04 ` Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211125203156.825539-1-hdegoede@redhat.com \
--to=hdegoede@redhat.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=paul.kocialkowski@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.