garmin parser: avoid build warning about converting pointer types

DECLARE_FIELD() uses array_uint_endian() to turn an integer type into
the right endianness.  It's all conditional on being an integer type,
but the compiler still sees the assignment (with a cast) for other
types, and complains about casting the 'unsigned int' return value to a
pointer, even when that case is not actually dynamically ever taken.

Fix the compiler warning by just changing the return type of this
conversion function to 'unsigned long' instead, which will match the
size of pointers on all relevant architectures.

Don't look at that macro too closely, you'll go blind.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Linus Torvalds 2023-02-09 11:23:03 -08:00
parent 9a3363dc7d
commit 1b9aea3213

View File

@ -449,7 +449,7 @@ static inline int base_type_is_integer(unsigned char base_type)
return !memcmp(base_type_info[base_type].type_name + 1, "INT", 3); return !memcmp(base_type_info[base_type].type_name + 1, "INT", 3);
} }
static inline unsigned int array_uint_endian(const unsigned char *p, unsigned int type_size, unsigned char bigendian) static inline unsigned long array_uint_endian(const unsigned char *p, unsigned int type_size, unsigned char bigendian)
{ {
if (bigendian) if (bigendian)
return array_uint_be(p, type_size); return array_uint_be(p, type_size);