Skip to content

Commit 26b9f2f

Browse files
Alexandru Eliseibroonie
authored andcommitted
ASoC: rockchip: i2s: Fix NULL pointer dereference when pinctrl is not found
Commit a5450ab ("ASoC: rockchip: i2s: switch BCLK to GPIO") switched BCLK to GPIO functions when probing the i2s bus interface, but missed adding a check for when devm_pinctrl_get() returns an error. This can lead to the following NULL pointer dereference on a rockpro64-v2 if there are no "pinctrl" properties in the i2s device tree node. Check that i2s->pinctrl is valid before attempting to search for the bclk_on and bclk_off pinctrl states. Fixes: a5450ab ("ASoC: rockchip: i2s: switch BCLK to GPIO") Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com> Link: https://lore.kernel.org/r/20220711130522.401551-1-alexandru.elisei@arm.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent fc976f5 commit 26b9f2f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sound/soc/rockchip/rockchip_i2s.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -808,8 +808,11 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
808808

809809
i2s->bclk_ratio = 64;
810810
i2s->pinctrl = devm_pinctrl_get(&pdev->dev);
811-
if (IS_ERR(i2s->pinctrl))
811+
if (IS_ERR(i2s->pinctrl)) {
812812
dev_err(&pdev->dev, "failed to find i2s pinctrl\n");
813+
ret = PTR_ERR(i2s->pinctrl);
814+
goto err_clk;
815+
}
813816

814817
i2s->bclk_on = pinctrl_lookup_state(i2s->pinctrl,
815818
"bclk_on");

0 commit comments

Comments
 (0)