PM / OPP: Fix static checker warning (broken 64bit big endian systems)
authorViresh Kumar <viresh.kumar@linaro.org>
Mon, 17 Aug 2015 13:50:20 +0000 (19:20 +0530)
committerChanwoo Choi <cw00.choi@samsung.com>
Mon, 4 Sep 2017 05:33:34 +0000 (14:33 +0900)
commit6606ddafa887198072aeeaca460ddfd5a8fe21ed
tree1fbfe47ea42cf791e86b8bbebaa7a524ba5d167a
parent750dba389ffa0f952619b495ac35ca77e3fc6bdf
PM / OPP: Fix static checker warning (broken 64bit big endian systems)

Dan Carpenter reported (generated with static checker):

drivers/base/power/opp.c:949 _opp_add_static_v2()
warn: passing casted pointer '&new_opp->clock_latency_ns' to
'of_property_read_u32()' 64 vs 32.

This code will break on 64 bit, big endian machines.

Fix this by reading the value in a u32 type variable first and then
assigning it to the unsigned long variable.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/power/opp.c