util/cbfstool: Refine type and signatures

As suggested by the linter:

> Prefer 'unsigned long' over 'unsigned long int' as the int is
> unnecessary

In fmap_bsearch(), removed needless assignment of offset; it is already
set to 0 in the search loop.

fmap_find() uses the return value of fmap_bsearch(); and is declared as
'long int'. Per the linter warnings, replaced 'long int' by 'long'.

> Prefer 'long' over 'long int' as the int is unnecessary

Link: https://qa.coreboot.org/job/coreboot-untested-files/lastSuccessfulBuild/artifact/lint.txt
Change-Id: If94e70778d0302552f151c31d3073524162faf9e
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/85786
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
This commit is contained in:
Ariel Otilibili 2025-01-11 15:12:39 +01:00 committed by Elyes Haouas
commit 29759ee6b9
2 changed files with 9 additions and 9 deletions

View file

@ -352,11 +352,11 @@ static int decode_mmap_arg(char *arg)
return 1;
union {
unsigned long int array[3];
unsigned long array[3];
struct {
unsigned long int flash_base;
unsigned long int mmap_base;
unsigned long int mmap_size;
unsigned long flash_base;
unsigned long mmap_base;
unsigned long mmap_size;
};
} mmap_args;
char *suffix = NULL;

View file

@ -74,7 +74,7 @@ static int is_valid_fmap(const struct fmap *fmap)
/* brute force linear search */
static long int fmap_lsearch(const uint8_t *image, size_t len)
{
unsigned long int offset;
unsigned long offset;
int fmap_found = 0;
for (offset = 0; offset < len - strlen(FMAP_SIGNATURE); offset++) {
@ -94,9 +94,9 @@ static long int fmap_lsearch(const uint8_t *image, size_t len)
}
/* if image length is a power of 2, use binary search */
static long int fmap_bsearch(const uint8_t *image, size_t len)
static long fmap_bsearch(const uint8_t *image, size_t len)
{
unsigned long int offset = -1;
unsigned long offset;
int fmap_found = 0, stride;
/*
@ -142,9 +142,9 @@ static int popcnt(unsigned int u)
return count;
}
long int fmap_find(const uint8_t *image, unsigned int image_len)
long fmap_find(const uint8_t *image, unsigned int image_len)
{
long int ret = -1;
long ret = -1;
if ((image == NULL) || (image_len == 0))
return -1;