summaryrefslogtreecommitdiff
path: root/sound/soc/fsl/fsl_asrc_m2m.c
diff options
context:
space:
mode:
authorShengjiu Wang <shengjiu.wang@freescale.com>2017-08-07 17:21:09 +0800
committerDong Aisheng <aisheng.dong@nxp.com>2019-11-25 15:48:30 +0800
commit5cfc86a07a661552eef70ec708027c8a39f7e6fa (patch)
tree67d1bbfd2c5b00593503cfd6ce03695d0c8bda82 /sound/soc/fsl/fsl_asrc_m2m.c
parent77924f38da9d811ca20d393294e9d5be6a0150ed (diff)
MLK-16154: ASoC: fsl_asrc_m2m: fix crash issue with multi-instance
When open 2 instances of m2m, there is kernel dump. The reason is we use the dev_set_drvdata to set drvdata for each instance, but each instance share a same device, the result is drvdata will be changed by other instances, then cause issue. so the dev_set_drvdata can't be used, need to combine the pair data with file handler. Fixes: 58ab1eb5b8c5 ("MLK-13945-3: ASoC: fsl_asrc: support two asrc devices") Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Diffstat (limited to 'sound/soc/fsl/fsl_asrc_m2m.c')
-rw-r--r--sound/soc/fsl/fsl_asrc_m2m.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sound/soc/fsl/fsl_asrc_m2m.c b/sound/soc/fsl/fsl_asrc_m2m.c
index 14877b43c4e1..e1b347801688 100644
--- a/sound/soc/fsl/fsl_asrc_m2m.c
+++ b/sound/soc/fsl/fsl_asrc_m2m.c
@@ -761,8 +761,7 @@ static long fsl_asrc_ioctl_flush(struct fsl_asrc_pair *pair, void __user *user)
static long fsl_asrc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
- struct miscdevice *asrc_miscdev = file->private_data;
- struct fsl_asrc_pair *pair = dev_get_drvdata(asrc_miscdev->this_device);
+ struct fsl_asrc_pair *pair = file->private_data;
struct fsl_asrc *asrc_priv = pair->asrc_priv;
void __user *user = (void __user *)arg;
long ret = 0;
@@ -833,7 +832,7 @@ static int fsl_asrc_open(struct inode *inode, struct file *file)
spin_lock_init(&m2m->lock);
- dev_set_drvdata(asrc_miscdev->this_device, pair);
+ file->private_data = pair;
pm_runtime_get_sync(dev);
@@ -846,8 +845,7 @@ out:
static int fsl_asrc_close(struct inode *inode, struct file *file)
{
- struct miscdevice *asrc_miscdev = file->private_data;
- struct fsl_asrc_pair *pair = dev_get_drvdata(asrc_miscdev->this_device);
+ struct fsl_asrc_pair *pair = file->private_data;
struct fsl_asrc_m2m *m2m = pair->private;
struct fsl_asrc *asrc_priv = pair->asrc_priv;
struct device *dev = &asrc_priv->pdev->dev;
@@ -885,6 +883,7 @@ static int fsl_asrc_close(struct inode *inode, struct file *file)
kfree(m2m);
kfree(pair);
spin_unlock_irqrestore(&asrc_priv->lock, lock_flags);
+ file->private_data = NULL;
pm_runtime_put_sync(dev);