Skip to content

Commit 500580c

Browse files
Zhang Zekunstorulf
authored andcommitted
pmdomain: qcom-cpr: Fix the return of uninitialized variable
The of_property_read_u64() can fail and remain the variable uninitialized, which will then be returned. Initializing the variable "rate" to zero to fix this problem. Fixes: 181c814 ("pmdomain: qcom-cpr: Use scope based of_node_put() to simplify code.") Reported-by: Dan Carpenter <[email protected]> Closes: https://lore.kernel.org/linux-pm/[email protected]/T/#m0a62b501b453a6d6e94c52a428a66f65b5422c65 Signed-off-by: Zhang Zekun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent eb83336 commit 500580c

File tree

1 file changed

+1
-1
lines changed
  • drivers/pmdomain/qcom

1 file changed

+1
-1
lines changed

drivers/pmdomain/qcom/cpr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ static unsigned long cpr_get_opp_hz_for_req(struct dev_pm_opp *ref,
10521052
of_parse_phandle(child_np, "required-opps", 0);
10531053

10541054
if (child_req_np == ref_np) {
1055-
u64 rate;
1055+
u64 rate = 0;
10561056

10571057
of_property_read_u64(child_np, "opp-hz", &rate);
10581058
return (unsigned long) rate;

0 commit comments

Comments
 (0)