From e0dc140d1cde87b0525f22ba573121d59bfc7c5e Mon Sep 17 00:00:00 2001 From: yangshuyong Date: Fri, 11 Aug 2023 14:30:17 +0800 Subject: [PATCH] added mutex lock before lookup reset controller by name Signed-off-by: yangshuyong --- drivers/reset/core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/reset/core.c b/drivers/reset/core.c index f0bfad0dab..9bbbab46f0 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -366,15 +366,18 @@ reset_controller_get_by_name(FAR const char *name) { FAR struct reset_controller_dev *rcdev; + nxmutex_lock(&g_reset_list_mutex); list_for_every_entry(&g_reset_controller_list, rcdev, struct reset_controller_dev, list) { if (!strcmp(name, rcdev->name)) { + nxmutex_unlock(&g_reset_list_mutex); return rcdev; } } + nxmutex_unlock(&g_reset_list_mutex); return NULL; }