Commit 439c491c authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] em28xx-audio: Fix error path

De-allocate memory and free sound if an error happens.
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent d2849fa5
...@@ -692,6 +692,7 @@ static int em28xx_audio_init(struct em28xx *dev) ...@@ -692,6 +692,7 @@ static int em28xx_audio_init(struct em28xx *dev)
if (intf->num_altsetting <= alt) { if (intf->num_altsetting <= alt) {
em28xx_errdev("alt %d doesn't exist on interface %d\n", em28xx_errdev("alt %d doesn't exist on interface %d\n",
dev->audio_ifnum, alt); dev->audio_ifnum, alt);
snd_card_free(card);
return -ENODEV; return -ENODEV;
} }
...@@ -707,6 +708,7 @@ static int em28xx_audio_init(struct em28xx *dev) ...@@ -707,6 +708,7 @@ static int em28xx_audio_init(struct em28xx *dev)
if (!ep) { if (!ep) {
em28xx_errdev("Couldn't find an audio endpoint"); em28xx_errdev("Couldn't find an audio endpoint");
snd_card_free(card);
return -ENODEV; return -ENODEV;
} }
...@@ -759,6 +761,7 @@ static int em28xx_audio_init(struct em28xx *dev) ...@@ -759,6 +761,7 @@ static int em28xx_audio_init(struct em28xx *dev)
err = snd_card_register(card); err = snd_card_register(card);
if (err < 0) { if (err < 0) {
em28xx_audio_free_urb(dev);
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment