mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-11 23:26:47 +07:00
ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe'
If this memory allocation fail, we must disable what has been enabled. Do not return immediately but go thrue the error handling path instead. Also use 'devm_kmemdup' instead of 'devm_kzalloc+memcpy' to simplify code. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
ec2212c4af
commit
c3a3d3c41b
@ -641,12 +641,13 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
|
|||||||
goto err_pm_disable;
|
goto err_pm_disable;
|
||||||
}
|
}
|
||||||
|
|
||||||
soc_dai = devm_kzalloc(&pdev->dev,
|
soc_dai = devm_kmemdup(&pdev->dev, &rockchip_i2s_dai
|
||||||
sizeof(*soc_dai), GFP_KERNEL);
|
sizeof(*soc_dai), GFP_KERNEL);
|
||||||
if (!soc_dai)
|
if (!soc_dai) {
|
||||||
return -ENOMEM;
|
err = -ENOMEM;
|
||||||
|
goto err_pm_disable;
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(soc_dai, &rockchip_i2s_dai, sizeof(*soc_dai));
|
|
||||||
if (!of_property_read_u32(node, "rockchip,playback-channels", &val)) {
|
if (!of_property_read_u32(node, "rockchip,playback-channels", &val)) {
|
||||||
if (val >= 2 && val <= 8)
|
if (val >= 2 && val <= 8)
|
||||||
soc_dai->playback.channels_max = val;
|
soc_dai->playback.channels_max = val;
|
||||||
|
Loading…
Reference in New Issue
Block a user