From: Peng Wu <wupeng58@huawei.com>
To: <jic23@kernel.org>, <lars@metafoo.de>, <nuno.sa@analog.com>,
<andy.shevchenko@gmail.com>
Cc: <linux-iio@vger.kernel.org>, <liwei391@huawei.com>,
Peng Wu <wupeng58@huawei.com>
Subject: [PATCH -next] iio: core: fix missing mutex_unlock() in iio_device_claim_buffer_mode()
Date: Fri, 4 Nov 2022 09:03:07 +0000 [thread overview]
Message-ID: <20221104090307.17734-1-wupeng58@huawei.com> (raw)
In the success path of iio_device_claim_buffer_mode(), mutex_unlock()
should be called before return.
Fixes: e6dad5edfb8c ("iio: core: introduce iio_device_{claim|release}_buffer_mode() APIs")
Signed-off-by: Peng Wu <wupeng58@huawei.com>
---
drivers/iio/industrialio-core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 52e690f031cb..88987cdc9e3f 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -2102,8 +2102,10 @@ int iio_device_claim_buffer_mode(struct iio_dev *indio_dev)
mutex_lock(&iio_dev_opaque->mlock);
- if (iio_buffer_enabled(indio_dev))
+ if (iio_buffer_enabled(indio_dev)) {
+ mutex_unlock(&iio_dev_opaque->mlock);
return 0;
+ }
mutex_unlock(&iio_dev_opaque->mlock);
return -EBUSY;
--
2.17.1
next reply other threads:[~2022-11-04 9:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-04 9:03 Peng Wu [this message]
2022-11-04 9:54 ` [PATCH -next] iio: core: fix missing mutex_unlock() in iio_device_claim_buffer_mode() Andy Shevchenko
2022-11-04 11:13 ` Nuno Sá
2022-11-04 12:52 ` Andy Shevchenko
2022-11-04 13:38 ` Nuno Sá
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=20221104090307.17734-1-wupeng58@huawei.com \
--to=wupeng58@huawei.com \
--cc=andy.shevchenko@gmail.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=liwei391@huawei.com \
--cc=nuno.sa@analog.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