diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index 2ecae0f0115..2958c6b7f99 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -4277,6 +4277,11 @@ next: static int ccc_set(const char *name, size_t len_rd, settings_read_cb read_cb, void *cb_arg) { + if (IS_ENABLED(CONFIG_BT_SETTINGS_CCC_LAZY_LOADING)) { + /* Only load CCCs on demand */ + return 0; + } + if (IS_ENABLED(CONFIG_BT_SETTINGS)) { struct ccc_store ccc_store[CCC_STORE_MAX]; struct ccc_load load; @@ -4334,10 +4339,7 @@ static int ccc_set(const char *name, size_t len_rd, settings_read_cb read_cb, return 0; } -#if !IS_ENABLED(CONFIG_BT_SETTINGS_CCC_LAZY_LOADING) -/* Only register the ccc_set settings handler when not loading on-demand */ SETTINGS_STATIC_HANDLER_DEFINE(bt_ccc, "bt/ccc", NULL, ccc_set, NULL, NULL); -#endif /* CONFIG_BT_SETTINGS_CCC_LAZY_LOADING */ static int ccc_set_direct(const char *key, size_t len, settings_read_cb read_cb, void *cb_arg, void *param)