ASoC: codecs: Check for error pointer after calling devm_regmap_init_mmio

[ Upstream commit aa505ecccf ]

Since the potential failure of the devm_regmap_init_mmio(), it will
return error pointer and be assigned to the regmap.
Then the error pointer will be dereferenced.
For example rx->regmap will be used in rx_macro_mclk_enable().
Therefore, it should be better to check it.

Fixes: af3d54b997 ("ASoC: codecs: lpass-rx-macro: add support for lpass rx macro")
Fixes: c39667ddcf ("ASoC: codecs: lpass-tx-macro: add support for lpass tx macro")
Fixes: 809bcbcece ("ASoC: codecs: lpass-wsa-macro: Add support to WSA Macro")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220121171031.2826198-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Jiasheng Jiang 2022-01-22 01:10:31 +08:00 коммит произвёл Greg Kroah-Hartman
Родитель e48b189799
Коммит 1179081ba5
3 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -3542,6 +3542,8 @@ static int rx_macro_probe(struct platform_device *pdev)
return PTR_ERR(base);
rx->regmap = devm_regmap_init_mmio(dev, base, &rx_regmap_config);
if (IS_ERR(rx->regmap))
return PTR_ERR(rx->regmap);
dev_set_drvdata(dev, rx);

Просмотреть файл

@ -1803,6 +1803,8 @@ static int tx_macro_probe(struct platform_device *pdev)
return PTR_ERR(base);
tx->regmap = devm_regmap_init_mmio(dev, base, &tx_regmap_config);
if (IS_ERR(tx->regmap))
return PTR_ERR(tx->regmap);
dev_set_drvdata(dev, tx);

Просмотреть файл

@ -2405,6 +2405,8 @@ static int wsa_macro_probe(struct platform_device *pdev)
return PTR_ERR(base);
wsa->regmap = devm_regmap_init_mmio(dev, base, &wsa_regmap_config);
if (IS_ERR(wsa->regmap))
return PTR_ERR(wsa->regmap);
dev_set_drvdata(dev, wsa);