aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Farrugia <mark.farrugia@fiberdyne.com.au>2018-11-20 18:28:11 +1100
committerMark Farrugia <mark.farrugia@fiberdyne.com.au>2018-11-20 18:28:11 +1100
commitd84d13e2e3b6f6d2674fa4793c37eff6736f8577 (patch)
tree89f82f2efc71f9eca857d2fe9995cabbfd4604c7
parentaf54a3dd7c7581a3039838591aec14720e854684 (diff)
Ensure snd_avirt_private_free is not called if NULL
We only want to call the snd_avirt_private_free callback if it is set. Some Audio Paths may only set the private data, and not the private free callback, so we need to accommodate for this. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
-rw-r--r--core.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/core.c b/core.c
index 35998c0..a733118 100644
--- a/core.c
+++ b/core.c
@@ -210,10 +210,10 @@ static void pcm_private_data_free(struct snd_pcm *pcm)
{
struct snd_avirt_private_data *avirt_private_data;
- D_PRINTK("Issuing free to private data struct");
- if (pcm->private_data) {
- avirt_private_data = pcm->private_data;
- if (avirt_private_data->ap_private_data)
+ avirt_private_data = (struct snd_avirt_private_data *)pcm->private_data;
+ if (avirt_private_data) {
+ if (avirt_private_data->ap_private_data &&
+ avirt_private_data->ap_private_free)
avirt_private_data->ap_private_free(pcm);
}