]>
Commit | Line | Data |
---|---|---|
edd3a73a GKH |
1 | From 440868661f36071886ed360d91de83bd67c73b4f Mon Sep 17 00:00:00 2001 |
2 | From: Phong Tran <tranmanphong@gmail.com> | |
3 | Date: Tue, 30 Apr 2019 21:56:24 +0700 | |
4 | Subject: of: fix clang -Wunsequenced for be32_to_cpu() | |
5 | ||
6 | From: Phong Tran <tranmanphong@gmail.com> | |
7 | ||
8 | commit 440868661f36071886ed360d91de83bd67c73b4f upstream. | |
9 | ||
10 | Now, make the loop explicit to avoid clang warning. | |
11 | ||
12 | ./include/linux/of.h:238:37: warning: multiple unsequenced modifications | |
13 | to 'cell' [-Wunsequenced] | |
14 | r = (r << 32) | be32_to_cpu(*(cell++)); | |
15 | ^~ | |
16 | ./include/linux/byteorder/generic.h:95:21: note: expanded from macro | |
17 | 'be32_to_cpu' | |
18 | ^ | |
19 | ./include/uapi/linux/byteorder/little_endian.h:40:59: note: expanded | |
20 | from macro '__be32_to_cpu' | |
21 | ^ | |
22 | ./include/uapi/linux/swab.h:118:21: note: expanded from macro '__swab32' | |
23 | ___constant_swab32(x) : \ | |
24 | ^ | |
25 | ./include/uapi/linux/swab.h:18:12: note: expanded from macro | |
26 | '___constant_swab32' | |
27 | (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \ | |
28 | ^ | |
29 | ||
30 | Signed-off-by: Phong Tran <tranmanphong@gmail.com> | |
31 | Reported-by: Nick Desaulniers <ndesaulniers@google.com> | |
32 | Link: https://github.com/ClangBuiltLinux/linux/issues/460 | |
33 | Suggested-by: David Laight <David.Laight@ACULAB.COM> | |
34 | Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> | |
35 | Cc: stable@vger.kernel.org | |
36 | [robh: fix up whitespace] | |
37 | Signed-off-by: Rob Herring <robh@kernel.org> | |
38 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
39 | ||
40 | --- | |
41 | include/linux/of.h | 4 ++-- | |
42 | 1 file changed, 2 insertions(+), 2 deletions(-) | |
43 | ||
44 | --- a/include/linux/of.h | |
45 | +++ b/include/linux/of.h | |
46 | @@ -220,8 +220,8 @@ extern struct device_node *of_find_all_n | |
47 | static inline u64 of_read_number(const __be32 *cell, int size) | |
48 | { | |
49 | u64 r = 0; | |
50 | - while (size--) | |
51 | - r = (r << 32) | be32_to_cpu(*(cell++)); | |
52 | + for (; size--; cell++) | |
53 | + r = (r << 32) | be32_to_cpu(*cell); | |
54 | return r; | |
55 | } | |
56 |