Skip to content

Commit 184ff4f

Browse files
nathanchancevireshk
authored andcommitted
OPP: Fix -Wunsequenced in _of_add_opp_table_v1()
Clang warns (or errors with CONFIG_WERROR=y): drivers/opp/of.c:1081:28: error: multiple unsequenced modifications to 'val' [-Werror,-Wunsequenced] 1081 | .freq = be32_to_cpup(val++) * 1000, | ^ 1082 | .u_volt = be32_to_cpup(val++), | ~~ 1 error generated. There is no sequence point in a designated initializer. Move back to separate variables for the creation of the values, so that there are sequence points between each evaluation and increment of val. Fixes: 75bbc92 ("OPP: Add dev_pm_opp_add_dynamic() to allow more flexibility") Signed-off-by: Nathan Chancellor <[email protected]> Reviewed-by: Nick Desaulniers <[email protected]> Signed-off-by: Viresh Kumar <[email protected]>
1 parent 693bb8a commit 184ff4f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/opp/of.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,9 +1077,11 @@ static int _of_add_opp_table_v1(struct device *dev, struct opp_table *opp_table)
10771077

10781078
val = prop->value;
10791079
while (nr) {
1080+
unsigned long freq = be32_to_cpup(val++) * 1000;
1081+
unsigned long volt = be32_to_cpup(val++);
10801082
struct dev_pm_opp_data data = {
1081-
.freq = be32_to_cpup(val++) * 1000,
1082-
.u_volt = be32_to_cpup(val++),
1083+
.freq = freq,
1084+
.u_volt = volt,
10831085
};
10841086

10851087
ret = _opp_add_v1(opp_table, dev, &data, false);

0 commit comments

Comments
 (0)