+ graph = bt_component_borrow_graph(component);
+
+ if (graph && bt_graph_is_canceled(graph)) {
+ BT_LOGW("Cannot add input port to sink component: graph is canceled: "
+ "comp-addr=%p, comp-name=\"%s\", graph-addr=%p",
+ component, bt_component_get_name(component),
+ bt_component_borrow_graph(component));
+ status = BT_COMPONENT_STATUS_GRAPH_IS_CANCELED;
+ goto end;
+ }
+
+ /* bt_component_add_input_port() logs details/errors */
+ port = bt_component_add_input_port(component, name, user_data);
+ if (!port) {
+ status = BT_COMPONENT_STATUS_NOMEM;
+ goto end;
+ }
+
+ if (user_priv_port) {
+ /* Move reference to user */
+ *user_priv_port = bt_private_port_from_port(port);
+ port = NULL;
+ }
+