MLK-16450-2: ASoC: fsl_hifi4: free unused memory when closing device
authorWeiguang Kong <weiguang.kong@nxp.com>
Wed, 13 Sep 2017 11:11:02 +0000 (19:11 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:38:32 +0000 (15:38 -0500)
free unused memory which is allocated in fsl_hifi4_open() function
when closing the hifi4 device.

Signed-off-by: Weiguang Kong <weiguang.kong@nxp.com>
sound/soc/fsl/fsl_hifi4.c

index a2ce78b..6201dd1 100644 (file)
@@ -1201,6 +1201,13 @@ static int fsl_hifi4_open(struct inode *inode, struct file *file)
 
 static int fsl_hifi4_close(struct inode *inode, struct file *file)
 {
+       struct fsl_hifi4 *hifi4_priv = dev_get_drvdata(hifi4_miscdev.parent);
+       struct device *dev = hifi4_priv->dev;
+       struct fsl_hifi4_engine *hifi4_engine;
+
+       hifi4_engine = file->private_data;
+       devm_kfree(dev, hifi4_engine);
+
        return 0;
 }