From 0648ff5649ce836f6952499104aa0cd0ba2537c8 Mon Sep 17 00:00:00 2001 From: Preston Baxter Date: Fri, 26 Jul 2024 20:54:11 -0500 Subject: [PATCH] tracking down null pointer --- aes67.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/aes67.c b/aes67.c index a316427..71a3298 100644 --- a/aes67.c +++ b/aes67.c @@ -43,6 +43,9 @@ struct aes67 { struct device *dev; }; +//Forward declarations +static int snd_aes67_new_pcm(struct aes67 *virtcard); + /* Destructor */ static int snd_aes67_free(struct aes67 *virtcard) { @@ -83,10 +86,20 @@ static int snd_aes67_create(struct snd_card *card, struct aes67 **rvirtcard) /* Build Sound Device */ err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, virtcard, &ops); if (err < 0) { + snd_printk(KERN_ERR "Failed to create AES67 device\n"); snd_aes67_free(virtcard); return err; } + /* Add PCM */ + err = snd_aes67_new_pcm(virtcard); + if (err < 0) { + snd_printk(KERN_ERR "Failed to create PCM for AES67 device\n"); + snd_aes67_free(virtcard); + return err; + } + + *rvirtcard = virtcard; return 0; } @@ -285,10 +298,13 @@ static int snd_aes67_new_pcm(struct aes67 *virtcard) struct snd_pcm *pcm; int err; + snd_printk(KERN_INFO "Initializing PCM for Virtual Soundcard"); err = snd_pcm_new(virtcard->card, CARD_NAME, 0, 1, 1, &pcm); if (err < 0) + snd_printk(KERN_INFO "Failed initializing PCM for Virtual Soundcard"); return err; + snd_printk(KERN_INFO "Assigning PCM to Virtual Soundcard"); pcm->private_data = virtcard; strcpy(pcm->name, CARD_NAME); virtcard->pcm = pcm;