- enum bt_port_status status = BT_PORT_STATUS_OK;
- struct bt_port *port = bt_port_borrow_from_private(private_port);
- struct bt_component *comp = NULL;
- enum bt_component_status comp_status;
-
- if (!port) {
- BT_LOGW_STR("Invalid parameter: private port is NULL.");
- status = BT_PORT_STATUS_INVALID;
- goto end;
- }
-
- comp = (void *) bt_object_get_parent(port);
- if (!comp) {
- BT_LOGV("Port already removed from its component: "
- "port-addr=%p, port-name=\"%s\", ",
- port, bt_port_get_name(port));
- goto end;
- }
-
- /* bt_component_remove_port() logs details */
- comp_status = bt_component_remove_port(comp, port);
- assert(comp_status != BT_COMPONENT_STATUS_INVALID);
- if (comp_status < 0) {
- status = BT_PORT_STATUS_ERROR;
- goto end;
- }
-
-end:
- bt_put(comp);
- return status;
+ BT_ASSERT_PRE_NON_NULL(port, "Port");
+ return port->connection ? BT_TRUE : BT_FALSE;