ctrl: error if program forgot to initialize the ctr handler before installing cmds

Change-Id: Icf3873f33470499fed3150ff51922a36aa0f023e
This commit is contained in:
Pau Espin 2023-01-05 17:10:35 +01:00 committed by pespin
parent 555c293867
commit e709bd4814
1 changed files with 10 additions and 0 deletions

View File

@ -210,6 +210,16 @@ int ctrl_cmd_install(enum ctrl_node_type node, struct ctrl_cmd_element *cmd)
{
vector cmds_vec;
/* If this assert triggers, it means the program forgot to initialize
* the CTRL interface first by calling ctrl_handle_alloc(2)() directly
* or indirectly through ctrl_interface_setup_dynip(2)()
*/
if (!ctrl_node_vec) {
LOGP(DLCTRL, LOGL_ERROR,
"ctrl_handle must be initialized prior to installing cmds.\n");
return -ENODEV;
}
cmds_vec = vector_lookup_ensure(ctrl_node_vec, node);
if (!cmds_vec) {