[PATCH] image.h: use uint32_t instead of u32 in android_image_get_dtb*

Heinrich Schuchardt xypron.debian at gmx.de
Sun Mar 1 21:57:46 CET 2020

On 2/20/20 12:45 PM, Sam Protsenko wrote:
> Hi Eugeniu,
> On Mon, Feb 17, 2020 at 12:24 PM Eugeniu Rosca <erosca at de.adit-jv.com> wrote:
>> Replace 'u32' by 'uint32_t' in image.h, since the former may lead to
>> build failures in U-Boot tooling (see [1]).
>> Avoid using 'uint', since it is not a fixed-width type [2], potentially
>> leading to a dangerous mismatch between the prototypes and definitions
>> of the android_image_get_dtb* functions.
>> This should be the quickest way to overcome the tooling build failure,
>> with more future-proof solutions being proposed by Yamada-san in [1].
>> [1] https://patchwork.ozlabs.org/patch/1238245/
>> [2] Excerpt from https://en.cppreference.com/w/cpp/language/types
>>   -----------8<------------
>>   Type specifier    Width in bits by data model
>>                     LP32  ILP32  LLP64  LP64
>>   unsigned int      16    32     32     32
>>   -----------8<------------
>> Cc: Tom Rini <trini at konsulko.com>
>> Cc: Sam Protsenko <joe.skb7 at gmail.com>
>> Fixes: 7f2531502c74c0 ("image: android: Add routine to get dtbo params")
>> Fixes: c3bfad825a71ea ("image: android: Add functions for handling dtb field")
>> Suggested-by: Masahiro Yamada <masahiroy at kernel.org>
>> Signed-off-by: Eugeniu Rosca <erosca at de.adit-jv.com>
>> ---
> Reviewed-by: Sam Protsenko <joe.skb7 at gmail.com>

uint32_t is defined in glibc's stdint.h and in our include/linux/types.h
(which is included in common.h).

We use image.h in tools/*.c in files which neither include common.h nor
stdint.h. But for USE_HOSTCC=y include/compiler.h includes stdint.h.

BUT changing a function definition in a header and not doing the same in
the C-file looks quite inconsistent to me.

Please, use the same types in both the C-file and in the header.

Best regards


More information about the U-Boot mailing list