Skip to content

Commit bf6d6e6

Browse files
plbossartvinodkoul
authored andcommitted
soundwire: intel: fix memory leak with devm_kasprintf
The dais are allocated with devm_kcalloc() but their name isn't resourced managed and never freed. Fix by also using devm_ for the dai names as well. Fixes: c46302e ('soundwire: intel: Add audio DAI ops') Signed-off-by: Pierre-Louis Bossart <[email protected]> Reviewed-by: Daniel Baluta <[email protected]> Reviewed-by: Kai Vehmanen <[email protected]> Reviewed-by: Rander Wang <[email protected]> Reviewed-by: Guennadi Liakhovetski <[email protected]> Reviewed-by: Bard Liao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent b3a9e3b commit bf6d6e6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/soundwire/intel.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -930,8 +930,9 @@ static int intel_create_dai(struct sdw_cdns *cdns,
930930

931931
/* TODO: Read supported rates/formats from hardware */
932932
for (i = off; i < (off + num); i++) {
933-
dais[i].name = kasprintf(GFP_KERNEL, "SDW%d Pin%d",
934-
cdns->instance, i);
933+
dais[i].name = devm_kasprintf(cdns->dev, GFP_KERNEL,
934+
"SDW%d Pin%d",
935+
cdns->instance, i);
935936
if (!dais[i].name)
936937
return -ENOMEM;
937938

0 commit comments

Comments
 (0)