aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/compress_offload.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/core/compress_offload.c')
-rw-r--r--sound/core/compress_offload.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index c40ae573346d..ad11dc994792 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -100,12 +100,15 @@ static int snd_compr_open(struct inode *inode, struct file *f)
100 100
101 if (dirn != compr->direction) { 101 if (dirn != compr->direction) {
102 pr_err("this device doesn't support this direction\n"); 102 pr_err("this device doesn't support this direction\n");
103 snd_card_unref(compr->card);
103 return -EINVAL; 104 return -EINVAL;
104 } 105 }
105 106
106 data = kzalloc(sizeof(*data), GFP_KERNEL); 107 data = kzalloc(sizeof(*data), GFP_KERNEL);
107 if (!data) 108 if (!data) {
109 snd_card_unref(compr->card);
108 return -ENOMEM; 110 return -ENOMEM;
111 }
109 data->stream.ops = compr->ops; 112 data->stream.ops = compr->ops;
110 data->stream.direction = dirn; 113 data->stream.direction = dirn;
111 data->stream.private_data = compr->private_data; 114 data->stream.private_data = compr->private_data;
@@ -113,6 +116,7 @@ static int snd_compr_open(struct inode *inode, struct file *f)
113 runtime = kzalloc(sizeof(*runtime), GFP_KERNEL); 116 runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
114 if (!runtime) { 117 if (!runtime) {
115 kfree(data); 118 kfree(data);
119 snd_card_unref(compr->card);
116 return -ENOMEM; 120 return -ENOMEM;
117 } 121 }
118 runtime->state = SNDRV_PCM_STATE_OPEN; 122 runtime->state = SNDRV_PCM_STATE_OPEN;
@@ -126,7 +130,8 @@ static int snd_compr_open(struct inode *inode, struct file *f)
126 kfree(runtime); 130 kfree(runtime);
127 kfree(data); 131 kfree(data);
128 } 132 }
129 return ret; 133 snd_card_unref(compr->card);
134 return 0;
130} 135}
131 136
132static int snd_compr_free(struct inode *inode, struct file *f) 137static int snd_compr_free(struct inode *inode, struct file *f)