ASoC: spacemit: add failure check for spacemit_i2s_init_dai()

Add error handling when memory allocation for dai fails in
spacemit_i2s_init_dai() call.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/aPtiNCZ_KBezL2Dr@stanley.mountain/#t
Fixes: fce2174490 ("ASoC: spacemit: add i2s support for K1 SoC")
Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
Closes: tag.  It would be easy to make the argument that the
Link: https://patch.msgid.link/20251028-fix-k1-i2s-v2-1-a547c15ed5c3@linux.spacemit.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Troy Mitchell 2025-10-28 09:32:09 +08:00 committed by Mark Brown
parent d29479abad
commit 7a78e38765
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -428,7 +428,9 @@ static int spacemit_i2s_probe(struct platform_device *pdev)
dev_set_drvdata(i2s->dev, i2s);
spacemit_i2s_init_dai(i2s, &dai, res->start + SSDATR);
ret = spacemit_i2s_init_dai(i2s, &dai, res->start + SSDATR);
if (ret)
return ret;
ret = devm_snd_soc_register_component(i2s->dev,
&spacemit_i2s_component,