From 70237d3a6681f9267ddbbb101f6e2b391e63c1ce Mon Sep 17 00:00:00 2001 From: Unsung Lee Date: Sun, 14 Jan 2024 20:05:21 +0900 Subject: [PATCH] storage-external: Fix bug callback is triggered wrongly Fix a bug callback is triggered wrongly when different storage's state is changed. Change-Id: Ia929a9d4cc7eee7990f79b73a8fe42cd7fca939b Signed-off-by: Unsung Lee --- src/storage-external.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/storage-external.c b/src/storage-external.c index 65719d4..4406e4c 100755 --- a/src/storage-external.c +++ b/src/storage-external.c @@ -191,8 +191,12 @@ static int storage_ext_id_changed(storage_ext_device *dev, enum storage_ext_stat return ret; } - SYS_G_LIST_FOREACH(cb_list[STORAGE_CALLBACK_ID], elem, cb_info) + SYS_G_LIST_FOREACH(cb_list[STORAGE_CALLBACK_ID], elem, cb_info) { + if (dev->storage_id != cb_info->id) + continue; + cb_info->state_cb(cb_info->id, state, cb_info->user_data); + } return 0; } -- 2.7.4