Commit 88e91c1d authored by Marcus Alanen's avatar Marcus Alanen Committed by Linus Torvalds

[PATCH] [patch, 2.5] sound_oss_ad1848.c doesn't release region on error

  Doesn't check request_region and doesn't release region on failed
  kmalloc.
parent e805719a
...@@ -1996,7 +1996,8 @@ int ad1848_init (char *name, int io_base, int irq, int dma_playback, ...@@ -1996,7 +1996,8 @@ int ad1848_init (char *name, int io_base, int irq, int dma_playback,
sprintf(dev_name, sprintf(dev_name,
"Generic audio codec (%s)", devc->chip_name); "Generic audio codec (%s)", devc->chip_name);
request_region(devc->base, 4, devc->name); if (!request_region(devc->base, 4, devc->name))
return -1;
conf_printf2(dev_name, devc->base, devc->irq, dma_playback, dma_capture); conf_printf2(dev_name, devc->base, devc->irq, dma_playback, dma_capture);
...@@ -2012,8 +2013,10 @@ int ad1848_init (char *name, int io_base, int irq, int dma_playback, ...@@ -2012,8 +2013,10 @@ int ad1848_init (char *name, int io_base, int irq, int dma_playback,
} }
portc = (ad1848_port_info *) kmalloc(sizeof(ad1848_port_info), GFP_KERNEL); portc = (ad1848_port_info *) kmalloc(sizeof(ad1848_port_info), GFP_KERNEL);
if(portc==NULL) if(portc==NULL) {
release_region(devc->base, 4);
return -1; return -1;
}
if ((my_dev = sound_install_audiodrv(AUDIO_DRIVER_VERSION, if ((my_dev = sound_install_audiodrv(AUDIO_DRIVER_VERSION,
dev_name, dev_name,
...@@ -2025,8 +2028,8 @@ int ad1848_init (char *name, int io_base, int irq, int dma_playback, ...@@ -2025,8 +2028,8 @@ int ad1848_init (char *name, int io_base, int irq, int dma_playback,
dma_playback, dma_playback,
dma_capture)) < 0) dma_capture)) < 0)
{ {
release_region(devc->base, 4);
kfree(portc); kfree(portc);
portc=NULL;
return -1; return -1;
} }
......
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