* [PATCH] ASoC: codecs: lpass-wsa-macro: Check for error pointer after calling devm_regmap_init_mmio
@ 2022-01-10 6:42 Jiasheng Jiang
2022-01-10 16:51 ` Cezary Rojewski
0 siblings, 1 reply; 2+ messages in thread
From: Jiasheng Jiang @ 2022-01-10 6:42 UTC (permalink / raw)
To: srinivas.kandagatla, bgoswami, lgirdwood, broonie, perex, tiwai
Cc: alsa-devel, linux-kernel, Jiasheng Jiang
The devm_regmap_init_mmio() may return error pointer in some cases, for
example the possible failure of the kzalloc() in
regmap_mmio_gen_context().
Then the wsa->regmap will be error pointer and be used in
wsa_macro_mclk_enable().
Therefore, it should be better to check it in order to avoid the
dereference of the error pointer.
Fixes: 809bcbcecebf ("ASoC: codecs: lpass-wsa-macro: Add support to WSA Macro")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
sound/soc/codecs/lpass-wsa-macro.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/soc/codecs/lpass-wsa-macro.c b/sound/soc/codecs/lpass-wsa-macro.c
index d3ac318fd6b6..dd1a8b7bc794 100644
--- a/sound/soc/codecs/lpass-wsa-macro.c
+++ b/sound/soc/codecs/lpass-wsa-macro.c
@@ -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);
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] ASoC: codecs: lpass-wsa-macro: Check for error pointer after calling devm_regmap_init_mmio
2022-01-10 6:42 [PATCH] ASoC: codecs: lpass-wsa-macro: Check for error pointer after calling devm_regmap_init_mmio Jiasheng Jiang
@ 2022-01-10 16:51 ` Cezary Rojewski
0 siblings, 0 replies; 2+ messages in thread
From: Cezary Rojewski @ 2022-01-10 16:51 UTC (permalink / raw)
To: Jiasheng Jiang, srinivas.kandagatla, bgoswami, lgirdwood,
broonie, perex, tiwai
Cc: alsa-devel, linux-kernel
On 2022-01-10 7:42 AM, Jiasheng Jiang wrote:
> The devm_regmap_init_mmio() may return error pointer in some cases, for
> example the possible failure of the kzalloc() in
> regmap_mmio_gen_context().
> Then the wsa->regmap will be error pointer and be used in
> wsa_macro_mclk_enable().
> Therefore, it should be better to check it in order to avoid the
> dereference of the error pointer.
>
> Fixes: 809bcbcecebf ("ASoC: codecs: lpass-wsa-macro: Add support to WSA Macro")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
> sound/soc/codecs/lpass-wsa-macro.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/sound/soc/codecs/lpass-wsa-macro.c b/sound/soc/codecs/lpass-wsa-macro.c
> index d3ac318fd6b6..dd1a8b7bc794 100644
> --- a/sound/soc/codecs/lpass-wsa-macro.c
> +++ b/sound/soc/codecs/lpass-wsa-macro.c
> @@ -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);
>
>
Hello,
Perhaps the cover-letter did not yet arrive, however, it would be good
to bundle similar patches together and provide a cover letter for such
series in the future.
I'm replying to the very first patch sent, but it's quite obvious that
lpass-rx and lpass-tx patches are related to this one and it is easier
to get a firm grasp over the changes - from reviewer's point of view -
if all the related ones are part of a single series.
Regards,
Czarek
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-10 16:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-10 6:42 [PATCH] ASoC: codecs: lpass-wsa-macro: Check for error pointer after calling devm_regmap_init_mmio Jiasheng Jiang
2022-01-10 16:51 ` Cezary Rojewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®