Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: Intel: Skylake: Fix the memory leak

This provide the fix for firmware memory by freeing the pointer in driver
remove where it is safe to do so

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Vinod Koul and committed by
Mark Brown
d8018361 fb203adc

+8
+2
sound/soc/intel/skylake/skl-topology.c
··· 1248 1248 skl->resource.max_mcps = SKL_MAX_MCPS; 1249 1249 skl->resource.max_mem = SKL_FW_MAX_MEM; 1250 1250 1251 + skl->tplg = fw; 1252 + 1251 1253 return 0; 1252 1254 }
+4
sound/soc/intel/skylake/skl.c
··· 25 25 #include <linux/pci.h> 26 26 #include <linux/pm_runtime.h> 27 27 #include <linux/platform_device.h> 28 + #include <linux/firmware.h> 28 29 #include <sound/pcm.h> 29 30 #include "skl.h" 30 31 ··· 520 519 { 521 520 struct hdac_ext_bus *ebus = pci_get_drvdata(pci); 522 521 struct skl *skl = ebus_to_skl(ebus); 522 + 523 + if (skl->tplg) 524 + release_firmware(skl->tplg); 523 525 524 526 if (pci_dev_run_wake(pci)) 525 527 pm_runtime_get_noresume(&pci->dev);
+2
sound/soc/intel/skylake/skl.h
··· 68 68 struct skl_dsp_resource resource; 69 69 struct list_head ppl_list; 70 70 struct list_head dapm_path_list; 71 + 72 + const struct firmware *tplg; 71 73 }; 72 74 73 75 #define skl_to_ebus(s) (&(s)->ebus)