diff options
author | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-01-14 11:49:04 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-01-14 11:49:04 -0500 |
commit | 452f236fcf845ba95c2f984f3157493e07383792 (patch) | |
tree | 43973519bf6c27b7c64c778e6f128454b08e5ab9 /drivers/media | |
parent | b49eb2bd71c39fb69ae9001dac9f07ae6259f9ef (diff) |
em28xx-alsa: Fix error patch for init/fini
If something bad happens during init, we free the card data.
However, we still keep it initialized, causing some dependent
code to be called at .fini.
Fix it.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/usb/em28xx/em28xx-audio.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-audio.c b/drivers/media/usb/em28xx/em28xx-audio.c index 1563f71a5ea2..45bea1adc11c 100644 --- a/drivers/media/usb/em28xx/em28xx-audio.c +++ b/drivers/media/usb/em28xx/em28xx-audio.c | |||
@@ -948,6 +948,7 @@ urb_free: | |||
948 | 948 | ||
949 | card_free: | 949 | card_free: |
950 | snd_card_free(card); | 950 | snd_card_free(card); |
951 | adev->sndcard = NULL; | ||
951 | 952 | ||
952 | return err; | 953 | return err; |
953 | } | 954 | } |
@@ -966,12 +967,12 @@ static int em28xx_audio_fini(struct em28xx *dev) | |||
966 | 967 | ||
967 | em28xx_info("Closing audio extension"); | 968 | em28xx_info("Closing audio extension"); |
968 | 969 | ||
969 | snd_card_disconnect(dev->adev.sndcard); | 970 | if (dev->adev.sndcard) { |
970 | flush_work(&dev->wq_trigger); | 971 | snd_card_disconnect(dev->adev.sndcard); |
972 | flush_work(&dev->wq_trigger); | ||
971 | 973 | ||
972 | em28xx_audio_free_urb(dev); | 974 | em28xx_audio_free_urb(dev); |
973 | 975 | ||
974 | if (dev->adev.sndcard) { | ||
975 | snd_card_free(dev->adev.sndcard); | 976 | snd_card_free(dev->adev.sndcard); |
976 | dev->adev.sndcard = NULL; | 977 | dev->adev.sndcard = NULL; |
977 | } | 978 | } |