]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.9.179/of-fix-clang-wunsequenced-for-be32_to_cpu.patch
Linux 4.9.179
[thirdparty/kernel/stable-queue.git] / releases / 4.9.179 / of-fix-clang-wunsequenced-for-be32_to_cpu.patch
CommitLineData
edd3a73a
GKH
1From 440868661f36071886ed360d91de83bd67c73b4f Mon Sep 17 00:00:00 2001
2From: Phong Tran <tranmanphong@gmail.com>
3Date: Tue, 30 Apr 2019 21:56:24 +0700
4Subject: of: fix clang -Wunsequenced for be32_to_cpu()
5
6From: Phong Tran <tranmanphong@gmail.com>
7
8commit 440868661f36071886ed360d91de83bd67c73b4f upstream.
9
10Now, make the loop explicit to avoid clang warning.
11
12./include/linux/of.h:238:37: warning: multiple unsequenced modifications
13to '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
20from 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
30Signed-off-by: Phong Tran <tranmanphong@gmail.com>
31Reported-by: Nick Desaulniers <ndesaulniers@google.com>
32Link: https://github.com/ClangBuiltLinux/linux/issues/460
33Suggested-by: David Laight <David.Laight@ACULAB.COM>
34Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
35Cc: stable@vger.kernel.org
36[robh: fix up whitespace]
37Signed-off-by: Rob Herring <robh@kernel.org>
38Signed-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