sound/oss/ad1889.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff -puN sound/oss/ad1889.c~janitor-error-path-ad1889 sound/oss/ad1889.c
--- linux-2.5.75-20030711_0808/sound/oss/ad1889.c~janitor-error-path-ad1889 Sat Jul 12 00:40:29 2003
+++ linux-2.5.75-20030711_0808-fr/sound/oss/ad1889.c Sat Jul 12 00:40:29 2003
@@ -236,16 +236,24 @@ static ad1889_dev_t *ad1889_alloc_dev(st
for (i = 0; i < AD_MAX_STATES; i++) {
dmabuf = &dev->state[i].dmabuf;
- if ((dmabuf->rawbuf = kmalloc(DMA_SIZE, GFP_KERNEL|GFP_DMA)) == NULL)
- return NULL;
+ dmabuf->rawbuf = kmalloc(DMA_SIZE, GFP_KERNEL|GFP_DMA);
+ if (!dmabuf->rawbuf)
+ goto err_free_dmabuf;
dmabuf->rawbuf_size = DMA_SIZE;
dmabuf->dma_handle = 0;
dmabuf->rd_ptr = dmabuf->wr_ptr = dmabuf->dma_len = 0UL;
dmabuf->ready = 0;
dmabuf->rate = 44100;
}
-
+out:
return dev;
+
+err_free_dmabuf:
+ while (--i >= 0)
+ kfree(dev->state[i].dmabuf.rawbuf);
+ kfree(dev);
+ dev = NULL;
+ goto out;
}
static void ad1889_free_dev(ad1889_dev_t *dev)
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/