Commit d8018361 authored by Vinod Koul's avatar Vinod Koul Committed by Mark Brown

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: default avatarVinod Koul <vinod.koul@intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent fb203adc
...@@ -1248,5 +1248,7 @@ int skl_tplg_init(struct snd_soc_platform *platform, struct hdac_ext_bus *ebus) ...@@ -1248,5 +1248,7 @@ int skl_tplg_init(struct snd_soc_platform *platform, struct hdac_ext_bus *ebus)
skl->resource.max_mcps = SKL_MAX_MCPS; skl->resource.max_mcps = SKL_MAX_MCPS;
skl->resource.max_mem = SKL_FW_MAX_MEM; skl->resource.max_mem = SKL_FW_MAX_MEM;
skl->tplg = fw;
return 0; return 0;
} }
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/firmware.h>
#include <sound/pcm.h> #include <sound/pcm.h>
#include "skl.h" #include "skl.h"
...@@ -520,6 +521,9 @@ static void skl_remove(struct pci_dev *pci) ...@@ -520,6 +521,9 @@ static void skl_remove(struct pci_dev *pci)
struct hdac_ext_bus *ebus = pci_get_drvdata(pci); struct hdac_ext_bus *ebus = pci_get_drvdata(pci);
struct skl *skl = ebus_to_skl(ebus); struct skl *skl = ebus_to_skl(ebus);
if (skl->tplg)
release_firmware(skl->tplg);
if (pci_dev_run_wake(pci)) if (pci_dev_run_wake(pci))
pm_runtime_get_noresume(&pci->dev); pm_runtime_get_noresume(&pci->dev);
pci_dev_put(pci); pci_dev_put(pci);
......
...@@ -68,6 +68,8 @@ struct skl { ...@@ -68,6 +68,8 @@ struct skl {
struct skl_dsp_resource resource; struct skl_dsp_resource resource;
struct list_head ppl_list; struct list_head ppl_list;
struct list_head dapm_path_list; struct list_head dapm_path_list;
const struct firmware *tplg;
}; };
#define skl_to_ebus(s) (&(s)->ebus) #define skl_to_ebus(s) (&(s)->ebus)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment