From: Chanwoo Choi Date: Fri, 19 Jul 2024 10:05:56 +0000 (+0900) Subject: util: device-notifier: Fix unreachable code when using unregister_notifier() X-Git-Tag: accepted/tizen/unified/20240722.104306~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F08%2F314808%2F1;p=platform%2Fcore%2Fsystem%2Fpass.git util: device-notifier: Fix unreachable code when using unregister_notifier() Fix unreachable code when using unregister_notifier() by returning the error code if failed. Before this patch, the usage code of unregister_notifier() is not able to receive the any error code. Change-Id: I1bf9575a05b8dd2ca1c47e26e063dc90dbf892e0 Signed-off-by: Chanwoo Choi --- diff --git a/src/util/device-notifier.c b/src/util/device-notifier.c index ab2c6bf..903bd23 100644 --- a/src/util/device-notifier.c +++ b/src/util/device-notifier.c @@ -78,6 +78,9 @@ int unregister_notifier(enum device_notifier_type status, GList *n; struct device_notifier *notifier; + if (status >= DEVICE_NOTIFIER_MAX || !func) + return -EINVAL; + for (n = device_notifier_list; n != NULL; n = n->next) { notifier = n->data; if ((notifier->status == status) &&