pdr: pldm_entity_get_num_children(): Don't return invalid values

Allow for future elision of the assertion.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Iea112ec0e7c8a659a8819031b35a8869d1e21545
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1524149..5b162c9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -67,6 +67,7 @@
 20. pdr: pldm_entity_association_tree_destroy_root(): Exit early on bad arg
 21. pdr: pldm_entity_association_pdr_extract(): Early exit on bad arguments
 22. pdr: pldm_entity_association_pdr_extract(): Assign out params at exit
+23. pdr: pldm_entity_get_num_children(): Don't return invalid values
 
 ### Deprecated
 
diff --git a/src/pdr.c b/src/pdr.c
index 3442c0f..7dff0c6 100644
--- a/src/pdr.c
+++ b/src/pdr.c
@@ -785,7 +785,7 @@
 	}
 
 	assert(count < UINT8_MAX);
-	return count;
+	return count < UINT8_MAX ? count : 0;
 }
 
 LIBPLDM_ABI_STABLE