Skip to content

Commit 4999d70

Browse files
robclarkbroonie
authored andcommitted
ASoC: rt5682: Fix crash due to out of scope stack vars
Move the declaration of temporary arrays to somewhere that won't go out of scope before the devm_clk_hw_register() call, lest we be at the whim of the compiler for whether those stack variables get overwritten. Fixes a crash seen with gcc version 11.2.1 20210728 (Red Hat 11.2.1-1) Fixes: edbd24e ("ASoC: rt5682: Drop usage of __clk_get_name()") Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Stephen Boyd <swboyd@chromium.org> Link: https://lore.kernel.org/r/20211118010453.843286-1-robdclark@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 12dc48f commit 4999d70

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

sound/soc/codecs/rt5682.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2858,24 +2858,26 @@ int rt5682_register_dai_clks(struct rt5682_priv *rt5682)
28582858

28592859
for (i = 0; i < RT5682_DAI_NUM_CLKS; ++i) {
28602860
struct clk_init_data init = { };
2861+
struct clk_parent_data parent_data;
2862+
const struct clk_hw *parent;
28612863

28622864
dai_clk_hw = &rt5682->dai_clks_hw[i];
28632865

28642866
switch (i) {
28652867
case RT5682_DAI_WCLK_IDX:
28662868
/* Make MCLK the parent of WCLK */
28672869
if (rt5682->mclk) {
2868-
init.parent_data = &(struct clk_parent_data){
2870+
parent_data = (struct clk_parent_data){
28692871
.fw_name = "mclk",
28702872
};
2873+
init.parent_data = &parent_data;
28712874
init.num_parents = 1;
28722875
}
28732876
break;
28742877
case RT5682_DAI_BCLK_IDX:
28752878
/* Make WCLK the parent of BCLK */
2876-
init.parent_hws = &(const struct clk_hw *){
2877-
&rt5682->dai_clks_hw[RT5682_DAI_WCLK_IDX]
2878-
};
2879+
parent = &rt5682->dai_clks_hw[RT5682_DAI_WCLK_IDX];
2880+
init.parent_hws = &parent;
28792881
init.num_parents = 1;
28802882
break;
28812883
default:

0 commit comments

Comments
 (0)