Commit 0cd03a0c authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] em28xx-audio: simplify error handling

Cleanup the error handling code at em28xx-audio init.
Reviewed-by: default avatarFrank Schäfer <fschaefer.oss@googlemail.com>
Tested-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 229295f1
...@@ -893,10 +893,8 @@ static int em28xx_audio_init(struct em28xx *dev) ...@@ -893,10 +893,8 @@ static int em28xx_audio_init(struct em28xx *dev)
adev->udev = dev->udev; adev->udev = dev->udev;
err = snd_pcm_new(card, "Em28xx Audio", 0, 0, 1, &pcm); err = snd_pcm_new(card, "Em28xx Audio", 0, 0, 1, &pcm);
if (err < 0) { if (err < 0)
snd_card_free(card); goto card_free;
return err;
}
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_em28xx_pcm_capture); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_em28xx_pcm_capture);
pcm->info_flags = 0; pcm->info_flags = 0;
...@@ -927,20 +925,23 @@ static int em28xx_audio_init(struct em28xx *dev) ...@@ -927,20 +925,23 @@ static int em28xx_audio_init(struct em28xx *dev)
} }
err = em28xx_audio_urb_init(dev); err = em28xx_audio_urb_init(dev);
if (err) { if (err)
snd_card_free(card); goto card_free;
return -ENODEV;
}
err = snd_card_register(card); err = snd_card_register(card);
if (err < 0) { if (err < 0)
em28xx_audio_free_urb(dev); goto urb_free;
snd_card_free(card);
return err;
}
em28xx_info("Audio extension successfully initialized\n"); em28xx_info("Audio extension successfully initialized\n");
return 0; return 0;
urb_free:
em28xx_audio_free_urb(dev);
card_free:
snd_card_free(card);
return err;
} }
static int em28xx_audio_fini(struct em28xx *dev) static int em28xx_audio_fini(struct em28xx *dev)
......
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