ASoC: rockchip: i2s: Fix crash on missing pinctrl
authorChen-Yu Tsai <wens@csie.org>
Tue, 21 Jun 2022 18:57:47 +0000 (02:57 +0800)
committerMark Brown <broonie@kernel.org>
Wed, 22 Jun 2022 12:39:37 +0000 (13:39 +0100)
commitc3b5fd7fbb698496461f280728b456d9927f22af
treef41786a0bf21e42bdc7b3df1577a4bdb8a5e0aca
parent0deb003933052ac1a44b5f94b927484be6e34f86
ASoC: rockchip: i2s: Fix crash on missing pinctrl

Commit 44f362c2cc6d ("ASoC: rockchip: i2s: switch BCLK to GPIO") added
pinctrl lookups, but did not skip the lookup if there was no pinctrl
device tied to the I2S controller. As a result, the lookup was done
on an invalid pointer in such cases, causing a kernel panic.

Only do the subsequent pinctrl state lookups and switch if a pinctrl
device was found.

i2s_pinctrl_select_bclk_{on,off} already guard against missing pinctrl
device or pinctrl state, so those two functions aren't touched.

Fixes: 44f362c2cc6d ("ASoC: rockchip: i2s: switch BCLK to GPIO")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Link: https://lore.kernel.org/r/20220621185747.2782-1-wens@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/rockchip/rockchip_i2s.c