Skip to content

Commit 53f3a90

Browse files
Chen Nibroonie
authored andcommitted
ASoC: amd: acp3x-rt5682-max9836: Add missing error check for clock acquisition
The acp3x_5682_init() function did not check the return value of clk_get(), which could lead to dereferencing error pointers in rt5682_clk_enable(). Fix this by: 1. Changing clk_get() to the device-managed devm_clk_get(). 2. Adding proper IS_ERR() checks for both clock acquisitions. Fixes: 6b8e4e7 ("ASoC: amd: Add machine driver for Raven based platform") Signed-off-by: Chen Ni <nichen@iscas.ac.cn> Link: https://patch.msgid.link/20260310024246.2153827-1-nichen@iscas.ac.cn Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 30e4b22 commit 53f3a90

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

sound/soc/amd/acp3x-rt5682-max9836.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,13 @@ static int acp3x_5682_init(struct snd_soc_pcm_runtime *rtd)
9494
return ret;
9595
}
9696

97-
rt5682_dai_wclk = clk_get(component->dev, "rt5682-dai-wclk");
98-
rt5682_dai_bclk = clk_get(component->dev, "rt5682-dai-bclk");
97+
rt5682_dai_wclk = devm_clk_get(component->dev, "rt5682-dai-wclk");
98+
if (IS_ERR(rt5682_dai_wclk))
99+
return PTR_ERR(rt5682_dai_wclk);
100+
101+
rt5682_dai_bclk = devm_clk_get(component->dev, "rt5682-dai-bclk");
102+
if (IS_ERR(rt5682_dai_bclk))
103+
return PTR_ERR(rt5682_dai_bclk);
99104

100105
ret = snd_soc_card_jack_new_pins(card, "Headset Jack",
101106
SND_JACK_HEADSET |

0 commit comments

Comments
 (0)