pdr: pldm_entity_node_get_remote_container_id() is a trivial accessor

Align its prototype and behaviour with the other trivial accessors:
Assert that the precondition for invocation is that entity points to a
valid object.

pldm_entity_node_get_remote_container_id() is marked as
LIBPLDM_ABI_TESTING so we are free to change it as necessary.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ic8a8c30df7e4245ce06d314e7a99f25890152c79
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8c137bc..d014b42 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -50,6 +50,8 @@
    - pldm_pdr_get_repo_size()
    - pldm_pdr_record_is_remote()
 
+9. pdr: pldm_entity_node_get_remote_container_id() is a trivial accessor
+
 ### Deprecated
 
 1. pldm_bios_table_attr_entry_integer_encode()
diff --git a/include/libpldm/pdr.h b/include/libpldm/pdr.h
index bff474a..65aff2c 100644
--- a/include/libpldm/pdr.h
+++ b/include/libpldm/pdr.h
@@ -360,12 +360,14 @@
 
 /** @brief Extract remote container id from the pldm_entity_node
  *
- *  @param[in] entity         - pointer to existing entity
+ *  @pre entity must point to a valid object
  *
- *  @param[out] cid           -  remote container id
+ *  @param[in] entity - pointer to existing entity
+ *
+ *  @return The remote container id
  */
-int pldm_entity_node_get_remote_container_id(const pldm_entity_node *entity,
-					     uint16_t *cid);
+uint16_t
+pldm_entity_node_get_remote_container_id(const pldm_entity_node *entity);
 
 /** @brief Destroy entity association tree
  *
diff --git a/src/pdr.c b/src/pdr.c
index 3cd0f3a..5012d88 100644
--- a/src/pdr.c
+++ b/src/pdr.c
@@ -472,15 +472,12 @@
 }
 
 LIBPLDM_ABI_TESTING
-int pldm_entity_node_get_remote_container_id(const pldm_entity_node *entity,
-					     uint16_t *cid)
+uint16_t
+pldm_entity_node_get_remote_container_id(const pldm_entity_node *entity)
 {
-	if (!entity) {
-		return -EINVAL;
-	}
+	assert(entity != NULL);
 
-	*cid = entity->remote_container_id;
-	return 0;
+	return entity->remote_container_id;
 }
 
 LIBPLDM_ABI_STABLE