[PATCH] ASoC: Intel: sst: Fix firmware resource leak in sst_request_fw()

From: aravindanilraj0702

Date: Fri Apr 03 2026 - 15:56:27 EST


From: Aravind Anilraj <aravindanilraj0702@xxxxxxxxx>

The sst_request_fw() function calls request_firmware() but does not
release the firmware on any return path, resulting in a resource leak.

Ensure release_firmware() is called after the firmware has been
processed to properly free the allocated resources.

This issue was identified by smatch.

Signed-off-by: Aravind Anilraj <aravindanilraj0702@xxxxxxxxx>
---
sound/soc/intel/atom/sst/sst_loader.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sound/soc/intel/atom/sst/sst_loader.c b/sound/soc/intel/atom/sst/sst_loader.c
index a043443d2887..cba7f26cb0fd 100644
--- a/sound/soc/intel/atom/sst/sst_loader.c
+++ b/sound/soc/intel/atom/sst/sst_loader.c
@@ -350,12 +350,14 @@ static int sst_request_fw(struct intel_sst_drv *sst)
}
if (fw == NULL) {
dev_err(sst->dev, "fw is returning as null\n");
- return -EINVAL;
+ retval = -EINVAL;
+ goto out;
}
mutex_lock(&sst->sst_lock);
retval = sst_cache_and_parse_fw(sst, fw);
mutex_unlock(&sst->sst_lock);
-
+out:
+ release_firmware(fw);
return retval;
}

--
2.47.3