ASoC: SDCA: Add allocation failure check for Entity name

Currently find_sdca_entity_iot() can allocate a string for the
Entity name but it doesn't check if that allocation succeeded.
Add the missing NULL check after the allocation.

Fixes: 48fa77af2f ("ASoC: SDCA: Add terminal type into input/output widget name")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20260303141707.3841635-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Charles Keepax 2026-03-03 14:17:07 +00:00 committed by Mark Brown
parent 70c3054505
commit 2799018103
No known key found for this signature in database
GPG key ID: 24D68B725D5487D0

View file

@ -1156,9 +1156,12 @@ static int find_sdca_entity_iot(struct device *dev,
if (!terminal->is_dataport) {
const char *type_name = sdca_find_terminal_name(terminal->type);
if (type_name)
if (type_name) {
entity->label = devm_kasprintf(dev, GFP_KERNEL, "%s %s",
entity->label, type_name);
if (!entity->label)
return -ENOMEM;
}
}
ret = fwnode_property_read_u32(entity_node,