提交 666d6a36 编写于 作者: H Heiner Kallweit 提交者: Greg Kroah-Hartman

nvmem: core: add locking to nvmem_find_cell

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: NHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: NSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 79fbf046
...@@ -287,9 +287,15 @@ static struct nvmem_cell *nvmem_find_cell(const char *cell_id) ...@@ -287,9 +287,15 @@ static struct nvmem_cell *nvmem_find_cell(const char *cell_id)
{ {
struct nvmem_cell *p; struct nvmem_cell *p;
mutex_lock(&nvmem_cells_mutex);
list_for_each_entry(p, &nvmem_cells, node) 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; return p;
}
mutex_unlock(&nvmem_cells_mutex);
return NULL; return NULL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册