While the code is correct, less sophisticated static analyzers (and users operating them..) trip over it, because they don't see that the be32_to_cpu argument is evaluated multiple times only if it's constant. Moving the side effect out: - Lets us avoid the false positive - Aligns us with what Linux does - Makes the code IMO a bit clearer Do so. Signed-off-by: Ahmad Fatoum <ahmad@xxxxxx> --- v2 -> v3: fix full stop at end of commit subject (Roland) v1 -> v2: fix inaccurate commit message (Sascha) --- include/of.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/of.h b/include/of.h index 85d55f9b57dc..08bbeaf4d21b 100644 --- a/include/of.h +++ b/include/of.h @@ -79,8 +79,8 @@ struct fdt_header *of_get_fixed_tree(struct device_node *node); static inline u64 of_read_number(const __be32 *cell, int size) { u64 r = 0; - while (size--) - r = (r << 32) | be32_to_cpu(*(cell++)); + for (; size--; cell++) + r = (r << 32) | be32_to_cpu(*cell); return r; } -- 2.20.1 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox