vc/siemens/hwilib: Change uint32_t return type to size_t

The commit fcff39f0ea ("vc/siemens/hwilib: Rename 'maxlen' to
'dstsize'") changed the 'dstsize' input parameter type from uint32_t to
size_t.

This patch changes also the return parameter, which is often directly
compared with the aforementioned input parameter value. This should
introduce no change on 32-bit builds and stay consistent across the
project in the case of 64-bit builds and avoid comparisons of integers
of different width here.

BUG=none
TEST=No changes to hwilib behavior on any of the siemens/mc_apl1 or
siemens/mc_ehl variants.

Change-Id: I0a623f55b596297cdb6e17232828b9536c9a43e6
Signed-off-by: Jan Samek <jan.samek@siemens.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/72667
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Mario Scheithauer <mario.scheithauer@siemens.com>
This commit is contained in:
Jan Samek 2023-02-02 14:14:50 +01:00 committed by Felix Held
parent eede5a2495
commit 8555cc47a5
2 changed files with 5 additions and 5 deletions

View File

@ -53,7 +53,7 @@ struct param_info {
struct param_pos pos[MAX_BLOCK_NUM]; struct param_pos pos[MAX_BLOCK_NUM];
uint64_t mask; uint64_t mask;
uint8_t mask_offset; uint8_t mask_offset;
uint32_t (*get_field)(const struct param_info *param, uint8_t *dst, size_t dstsize); size_t (*get_field)(const struct param_info *param, uint8_t *dst, size_t dstsize);
}; };
/* Storage for pointers to the different blocks. The contents will be filled /* Storage for pointers to the different blocks. The contents will be filled
@ -69,7 +69,7 @@ static uint16_t all_blk_size[MAX_BLOCK_NUM];
/* Storage for the cbfs file name of the currently open hwi file. */ /* Storage for the cbfs file name of the currently open hwi file. */
static char current_hwi[HWI_MAX_NAME_LEN]; static char current_hwi[HWI_MAX_NAME_LEN];
static uint32_t hwilib_read_bytes(const struct param_info *param, uint8_t *dst, size_t dstsize); static size_t hwilib_read_bytes(const struct param_info *param, uint8_t *dst, size_t dstsize);
/* Add all supported fields to this variable. It is important to use the /* Add all supported fields to this variable. It is important to use the
* field type of a given field as the array index so that all the information * field type of a given field as the array index so that all the information
@ -385,7 +385,7 @@ static const struct param_info params[] = {
* @param dstsize Size of the memory passed in via the *dst pointer * @param dstsize Size of the memory passed in via the *dst pointer
* @return Number of copied bytes on success, 0 on error * @return Number of copied bytes on success, 0 on error
*/ */
static uint32_t hwilib_read_bytes(const struct param_info *param, uint8_t *dst, size_t dstsize) static size_t hwilib_read_bytes(const struct param_info *param, uint8_t *dst, size_t dstsize)
{ {
uint8_t i = 0, *blk = NULL; uint8_t i = 0, *blk = NULL;
@ -541,7 +541,7 @@ enum cb_err hwilib_find_blocks(const char *hwi_filename)
* @param dstsize Size of the memory passed in via the *dst pointer * @param dstsize Size of the memory passed in via the *dst pointer
* @return Number of copied bytes on success, 0 on error * @return Number of copied bytes on success, 0 on error
*/ */
uint32_t hwilib_get_field(hwinfo_field_t field, uint8_t *dst, size_t dstsize) size_t hwilib_get_field(hwinfo_field_t field, uint8_t *dst, size_t dstsize)
{ {
/* Check the boundaries of params-variable */ /* Check the boundaries of params-variable */
if ((uint32_t)field < ARRAY_SIZE(params)) if ((uint32_t)field < ARRAY_SIZE(params))

View File

@ -123,6 +123,6 @@ enum cb_err hwilib_find_blocks(const char *hwi_filename);
/* Use this function to get fields out of supported info blocks /* Use this function to get fields out of supported info blocks
* This function returns the number of copied bytes or 0 on error. * This function returns the number of copied bytes or 0 on error.
*/ */
uint32_t hwilib_get_field(hwinfo_field_t field, uint8_t *dst, size_t dstsize); size_t hwilib_get_field(hwinfo_field_t field, uint8_t *dst, size_t dstsize);
#endif /* SIEMENS_HWI_LIB_H_ */ #endif /* SIEMENS_HWI_LIB_H_ */