tracking down null pointer

This commit is contained in:
Preston Baxter 2024-07-26 20:54:11 -05:00
parent 6f419581ba
commit 0648ff5649
1 changed files with 16 additions and 0 deletions

16
aes67.c
View File

@ -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;