+static int ec_node_cmd_init_func(void)
+{
+ ec_node_cmd_expr = ec_node_cmd_build_expr();
+ if (ec_node_cmd_expr == NULL)
+ goto fail;
+
+ ec_node_cmd_parser = ec_node_cmd_build_parser(ec_node_cmd_expr);
+ if (ec_node_cmd_parser == NULL)
+ goto fail;
+
+ return 0;
+
+fail:
+ EC_LOG(EC_LOG_ERR, "Failed to initialize command parser\n");
+ ec_node_free(ec_node_cmd_expr);
+ ec_node_cmd_expr = NULL;
+ ec_node_free(ec_node_cmd_parser);
+ ec_node_cmd_parser = NULL;
+ return -1;
+}
+
+static void ec_node_cmd_exit_func(void)
+{
+ ec_node_free(ec_node_cmd_expr);
+ ec_node_cmd_expr = NULL;
+ ec_node_free(ec_node_cmd_parser);
+ ec_node_cmd_parser = NULL;
+}
+
+static struct ec_init ec_node_cmd_init = {
+ .init = ec_node_cmd_init_func,
+ .exit = ec_node_cmd_exit_func,
+ .priority = 75,
+};
+
+EC_INIT_REGISTER(ec_node_cmd_init);
+