diff options
author | Duncan Sands <duncan.sands@math.u\-psud.fr> | 2006-03-14 10:12:39 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-21 11:53:21 -0500 |
commit | 31dcbf994b9eda784c620c8caa3a9dc67a9d0045 (patch) | |
tree | 889d77d98d5584c7f90293344e56da62fd77a891 | |
parent | ae24601b47c3f4a56545ef4cd4e7c821ac1db598 (diff) |
V4L/DVB (3488): Snd_cx88_create: don't dereference NULL core
If the call to cx88_core_get returns a NULL value, it is dereferenced
by cx88_reset, and perhaps by cx88_core_put. Spotted by the Coverity
checker.
Signed-off-by: Duncan Sands <baldrick@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/video/cx88/cx88-alsa.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c index 2acccd6d49bc..bffef1decc8b 100644 --- a/drivers/media/video/cx88/cx88-alsa.c +++ b/drivers/media/video/cx88/cx88-alsa.c | |||
@@ -672,6 +672,11 @@ static int __devinit snd_cx88_create(snd_card_t *card, struct pci_dev *pci, | |||
672 | chip = (snd_cx88_card_t *) card->private_data; | 672 | chip = (snd_cx88_card_t *) card->private_data; |
673 | 673 | ||
674 | core = cx88_core_get(pci); | 674 | core = cx88_core_get(pci); |
675 | if (NULL == core) { | ||
676 | err = -EINVAL; | ||
677 | kfree (chip); | ||
678 | return err; | ||
679 | } | ||
675 | 680 | ||
676 | if (!pci_dma_supported(pci,0xffffffff)) { | 681 | if (!pci_dma_supported(pci,0xffffffff)) { |
677 | dprintk(0, "%s/1: Oops: no 32bit PCI DMA ???\n",core->name); | 682 | dprintk(0, "%s/1: Oops: no 32bit PCI DMA ???\n",core->name); |
@@ -688,11 +693,6 @@ static int __devinit snd_cx88_create(snd_card_t *card, struct pci_dev *pci, | |||
688 | spin_lock_init(&chip->reg_lock); | 693 | spin_lock_init(&chip->reg_lock); |
689 | 694 | ||
690 | cx88_reset(core); | 695 | cx88_reset(core); |
691 | if (NULL == core) { | ||
692 | err = -EINVAL; | ||
693 | kfree (chip); | ||
694 | return err; | ||
695 | } | ||
696 | chip->core = core; | 696 | chip->core = core; |
697 | 697 | ||
698 | /* get irq */ | 698 | /* get irq */ |