From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Heiner Kallweit <hkallweit1@gmail.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] nvmem: core: add locking to nvmem_find_cell
Date: Wed, 7 Jun 2017 16:30:58 +0100 [thread overview]
Message-ID: <24d689a7-bc27-e384-3741-efd9e6221bcb@linaro.org> (raw)
In-Reply-To: <c002e145-32ff-9ab2-5f7d-8539c974328c@gmail.com>
On 04/06/17 12:01, Heiner Kallweit wrote:
> Adding entries to nvmem_cells and deleting entries from it is
> protected by nvmem_cells_mutex. Therefore this mutex should
> also protect iterating over the list.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
> drivers/nvmem/core.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index 4e07f3f8..1aa6d25a 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -286,9 +286,15 @@ static struct nvmem_cell *nvmem_find_cell(const char *cell_id)
> {
> struct nvmem_cell *p;
>
> + mutex_lock(&nvmem_cells_mutex);
> +
> list_for_each_entry(p, &nvmem_cells, node)
> - if (p && !strcmp(p->name, cell_id))
> + if (p && !strcmp(p->name, cell_id)) {
> + mutex_unlock(&nvmem_cells_mutex);
> return p;
> + }
> +
> + mutex_unlock(&nvmem_cells_mutex);
>
Thanks for the patch, I will queue this up.
Thanks,
srini
> return NULL;
> }
>
next prev parent reply other threads:[~2017-06-07 15:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-04 10:48 [PATCH 0/3] nvmem: core: series with smaller refactorings Heiner Kallweit
2017-06-04 11:01 ` [PATCH 1/3] nvmem: core: remove member users from struct nvmem_device Heiner Kallweit
2017-06-07 15:30 ` Srinivas Kandagatla
2017-06-07 21:51 ` Heiner Kallweit
2017-06-08 6:34 ` Srinivas Kandagatla
2017-06-04 11:01 ` [PATCH 2/3] nvmem: core: add locking to nvmem_find_cell Heiner Kallweit
2017-06-07 15:30 ` Srinivas Kandagatla [this message]
2017-06-04 11:02 ` [PATCH 3/3] nvmem: core: remove nvmem_mutex Heiner Kallweit
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=24d689a7-bc27-e384-3741-efd9e6221bcb@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=hkallweit1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/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