From: Hugues Fruchet <hugues.fruchet@st.com>
To: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>,
Sakari Ailus <sakari.ailus@iki.fi>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
"Hans Verkuil" <hverkuil@xs4all.nl>
Cc: <linux-kernel@vger.kernel.org>, <linux-media@vger.kernel.org>,
"Hugues Fruchet" <hugues.fruchet@st.com>
Subject: [PATCH v1 2/2] [media] ov9655: fix missing mutex_destroy()
Date: Fri, 21 Jul 2017 17:49:41 +0200 [thread overview]
Message-ID: <1500652181-971-3-git-send-email-hugues.fruchet@st.com> (raw)
In-Reply-To: <1500652181-971-1-git-send-email-hugues.fruchet@st.com>
Fix missing mutex_destroy() when probe fails and
when driver is removed.
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
---
drivers/media/i2c/ov9650.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/ov9650.c b/drivers/media/i2c/ov9650.c
index e8dea28..6ffb460 100644
--- a/drivers/media/i2c/ov9650.c
+++ b/drivers/media/i2c/ov9650.c
@@ -1505,13 +1505,13 @@ static int ov965x_probe(struct i2c_client *client,
ret = ov965x_configure_gpios(ov965x, pdata);
if (ret < 0)
- return ret;
+ goto err_mutex;
ov965x->pad.flags = MEDIA_PAD_FL_SOURCE;
sd->entity.function = MEDIA_ENT_F_CAM_SENSOR;
ret = media_entity_pads_init(&sd->entity, 1, &ov965x->pad);
if (ret < 0)
- return ret;
+ goto err_mutex;
ret = ov965x_initialize_controls(ov965x);
if (ret < 0)
@@ -1537,16 +1537,20 @@ static int ov965x_probe(struct i2c_client *client,
v4l2_ctrl_handler_free(sd->ctrl_handler);
err_me:
media_entity_cleanup(&sd->entity);
+err_mutex:
+ mutex_destroy(&ov965x->lock);
return ret;
}
static int ov965x_remove(struct i2c_client *client)
{
struct v4l2_subdev *sd = i2c_get_clientdata(client);
+ struct ov965x *ov965x = to_ov965x(sd);
v4l2_async_unregister_subdev(sd);
v4l2_ctrl_handler_free(sd->ctrl_handler);
media_entity_cleanup(&sd->entity);
+ mutex_destroy(&ov965x->lock);
return 0;
}
--
1.9.1
next prev parent reply other threads:[~2017-07-21 15:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-21 15:49 [PATCH v1 0/2] OV9650 code cleanup Hugues Fruchet
2017-07-21 15:49 ` [PATCH v1 1/2] [media] ov9650: fix coding style Hugues Fruchet
2017-07-21 15:49 ` Hugues Fruchet [this message]
2017-08-08 13:28 ` [PATCH v1 2/2] [media] ov9655: fix missing mutex_destroy() Sakari Ailus
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=1500652181-971-3-git-send-email-hugues.fruchet@st.com \
--to=hugues.fruchet@st.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@iki.fi \
--cc=sylvester.nawrocki@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox