pdr: Introduce pldm_pdr_add_fru_record_set_check()

pldm_pdr_add_fru_record_set() relied on assert() to communicate failure
to the caller. Introduce pldm_pdr_add_fru_record_set_check() which
instead returns a value indicating success or failure.
pldm_pdr_add_fru_record_set() will be deprecated once
pldm_pdr_add_fru_record_set_check() is stabilised.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I1e09a5663895f1e09b5e40afe5db4b4864d3496e
diff --git a/include/libpldm/pdr.h b/include/libpldm/pdr.h
index 621974a..e929914 100644
--- a/include/libpldm/pdr.h
+++ b/include/libpldm/pdr.h
@@ -260,6 +260,29 @@
 				     uint16_t container_id,
 				     uint32_t bmc_record_handle);
 
+/** @brief Add a FRU record set PDR record to a PDR repository, or return an error
+ *
+ *  @param[in/out] repo - opaque pointer acting as a PDR repo handle
+ *  @param[in] terminus_handle - PLDM terminus handle of terminus owning the PDR
+ *  record
+ *  @param[in] fru_rsi - FRU record set identifier
+ *  @param[in] entity_type - entity type of FRU
+ *  @param[in] entity_instance_num - entity instance number of FRU
+ *  @param[in] container_id - container id of FRU
+ *  @param[in,out] bmc_record_handle - A pointer to the handle used to construct the next record. If
+ *  		   the value is zero on input then a new handle is automatically allocated.
+ *  		   Otherwise, the provided handle is used. If a new handle is automatically
+ *  		   allocated then the object pointed to by bmc_record_handle will contain its value
+ *  		   as output.
+ *  @return 0 on success, -EINVAL if the arguments are invalid, or -ENOMEM if an internal allocation
+ *  	    fails.
+ */
+int pldm_pdr_add_fru_record_set_check(pldm_pdr *repo, uint16_t terminus_handle,
+				      uint16_t fru_rsi, uint16_t entity_type,
+				      uint16_t entity_instance_num,
+				      uint16_t container_id,
+				      uint32_t *bmc_record_handle);
+
 /** @brief Find a FRU record set PDR by FRU record set identifier
  *
  *  @param[in] repo - opaque pointer acting as a PDR repo handle