Skip to content

Commit 750dc2f

Browse files
robclarkbroonie
authored andcommitted
ASoC: rt5682s: 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: bdd229a ("ASoC: rt5682s: Add driver for ALC5682I-VS codec") Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Stephen Boyd <swboyd@chromium.org> Link: https://lore.kernel.org/r/20211118010453.843286-2-robdclark@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 4999d70 commit 750dc2f

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

sound/soc/codecs/rt5682s.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2693,24 +2693,26 @@ static int rt5682s_register_dai_clks(struct snd_soc_component *component)
26932693

26942694
for (i = 0; i < RT5682S_DAI_NUM_CLKS; ++i) {
26952695
struct clk_init_data init = { };
2696+
struct clk_parent_data parent_data;
2697+
const struct clk_hw *parent;
26962698

26972699
dai_clk_hw = &rt5682s->dai_clks_hw[i];
26982700

26992701
switch (i) {
27002702
case RT5682S_DAI_WCLK_IDX:
27012703
/* Make MCLK the parent of WCLK */
27022704
if (rt5682s->mclk) {
2703-
init.parent_data = &(struct clk_parent_data){
2705+
parent_data = (struct clk_parent_data){
27042706
.fw_name = "mclk",
27052707
};
2708+
init.parent_data = &parent_data;
27062709
init.num_parents = 1;
27072710
}
27082711
break;
27092712
case RT5682S_DAI_BCLK_IDX:
27102713
/* Make WCLK the parent of BCLK */
2711-
init.parent_hws = &(const struct clk_hw *){
2712-
&rt5682s->dai_clks_hw[RT5682S_DAI_WCLK_IDX]
2713-
};
2714+
parent = &rt5682s->dai_clks_hw[RT5682S_DAI_WCLK_IDX];
2715+
init.parent_hws = &parent;
27142716
init.num_parents = 1;
27152717
break;
27162718
default:

0 commit comments

Comments
 (0)