why h_set not called

I am trying to save data by using the setting subsystem of nrf connect sdk, and i <init> and <register> the settings, and when the setting_load function excuted, the h_set callback function of the setting handler i register above was not called, and i don't know what leads to the problem. my code is followed, can someone help me to address it, thanks so much.

static int8_t foo_val = -1;

static int foo_settings_set(const char *name, size_t len,
                            settings_read_cb read_cb, void *cb_arg)
{
    printk("foo_settings_set\n");
    const char *next;
    int rc;

    if (settings_name_steq(name, "bar", &next) && !next) {
        if (len != sizeof(foo_val)) {
            return -EINVAL;
        }

        rc = read_cb(cb_arg, &foo_val, sizeof(foo_val));
        if (rc >= 0) {
            return 0;
        }

        return rc;
    }


    return -ENOENT;
}

struct settings_handler my_conf = {
    .name = "foo",
    .h_set = foo_settings_set
};

void main(void)
{
	int rc;
    rc = settings_subsys_init();
	printk("rc1 = %d", rc);
    rc = settings_register(&my_conf);
	printk("rc2 = %d", rc);
    rc = settings_load();
	printk("rc3 = %d", rc);
	rc = settings_load_subtree("foo");
	printk("rc4 = %d", rc);
	rc = settings_load_subtree("foo/bar");
	printk("rc5 = %d", rc);

    foo_val++;
    settings_save_one("foo/bar", &foo_val, sizeof(foo_val));

    printk("foo: %d\n", foo_val);

    k_msleep(1000);
    sys_reboot(SYS_REBOOT_COLD);
}

and the debug message shows that the <foo_settings_set> function is not called.

00> *** Booting Zephyr OS build v2.7.99-ncs1  ***
00> rc1 = 0rc2 = 0rc3 = 0rc4 = 0rc5 = 0foo: 0
00> *** Booting Zephyr OS build v2.7.99-ncs1  ***
00> rc1 = 0rc2 = 0rc3 = 0rc4 = 0rc5 = 0foo: 0
00> *** Booting Zephyr OS build v2.7.99-ncs1  ***
00> rc1 = 0rc2 = 0rc3 = 0rc4 = 0rc5 = 0foo: 0
00> *** Booting Zephyr OS build v2.7.99-ncs1  ***
00> rc1 = 0rc2 = 0rc3 = 0rc4 = 0rc5 = 0foo: 0
00> *** Booting Zephyr OS build v2.7.99-ncs1  ***
00> rc1 = 0rc2 = 0rc3 = 0rc4 = 0rc5 = 0foo: 0
00> *** Booting Zephyr OS build v2.7.99-ncs1  ***
00> rc1 = 0rc2 = 0rc3 = 0rc4 = 0rc5 = 0foo: 0

Parents Reply Children
No Data
Related