Skip to content

Commit 9c0c54a

Browse files
Mike Tiptongregkh
authored andcommitted
interconnect: qcom: Fix uninitialized tcs_cmd::wait
Currently, if tcs_cmd_gen is called with commit=false, then tcs_cmd::wait is left uninitialized. Since the tcs_cmd structures passed to this function aren't zero-initialized, then we're left with random wait values. This results in waiting for completion for more commands than is necessary, depending on what's on the stack at the time. Removing the unnecessary if-condition fixes this, but add an explicit memset of the tcs_cmd structure as well to ensure predictable behavior if more tcs_cmd members are added in the future. Fixes: 976daac ("interconnect: qcom: Consolidate interconnect RPMh support") Signed-off-by: Mike Tipton <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Georgi Djakov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2d3008f commit 9c0c54a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/interconnect/qcom/bcm-voter.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ static inline void tcs_cmd_gen(struct tcs_cmd *cmd, u64 vote_x, u64 vote_y,
9696
if (!cmd)
9797
return;
9898

99+
memset(cmd, 0, sizeof(*cmd));
100+
99101
if (vote_x == 0 && vote_y == 0)
100102
valid = false;
101103

@@ -112,8 +114,7 @@ static inline void tcs_cmd_gen(struct tcs_cmd *cmd, u64 vote_x, u64 vote_y,
112114
* Set the wait for completion flag on command that need to be completed
113115
* before the next command.
114116
*/
115-
if (commit)
116-
cmd->wait = true;
117+
cmd->wait = commit;
117118
}
118119

119120
static void tcs_list_gen(struct list_head *bcm_list, int bucket,

0 commit comments

Comments
 (0)