diff options
| author | Pierre-Louis Bossart <[email protected]> | 2020-06-17 16:35:36 +0000 |
|---|---|---|
| committer | Vinod Koul <[email protected]> | 2020-06-22 11:45:20 +0000 |
| commit | bf6d6e68d2028a2d82f4c106f50ec75cc1e6ef89 (patch) | |
| tree | 2f924dcc75c787859e2911a0b1b6917f0967f024 | |
| parent | Linux 5.8-rc1 (diff) | |
| download | kernel-bf6d6e68d2028a2d82f4c106f50ec75cc1e6ef89.tar.gz kernel-bf6d6e68d2028a2d82f4c106f50ec75cc1e6ef89.zip | |
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: c46302ec554c5 ('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]>
| -rw-r--r-- | drivers/soundwire/intel.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 4cfdd074e310..c7422740edd4 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -930,8 +930,9 @@ static int intel_create_dai(struct sdw_cdns *cdns, /* TODO: Read supported rates/formats from hardware */ for (i = off; i < (off + num); i++) { - dais[i].name = kasprintf(GFP_KERNEL, "SDW%d Pin%d", - cdns->instance, i); + dais[i].name = devm_kasprintf(cdns->dev, GFP_KERNEL, + "SDW%d Pin%d", + cdns->instance, i); if (!dais[i].name) return -ENOMEM; |
