From 161b114d426e0f8ee5ca330ce36f55bc75dfebb5 Mon Sep 17 00:00:00 2001 From: hhb Date: Wed, 19 Nov 2014 15:26:15 +0800 Subject: [PATCH] DMA pl330: pl330_get_desc try more to get desc --- drivers/dma/pl330.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 819328b2e3ec..3310b50fafec 100755 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -2760,22 +2760,29 @@ static struct dma_pl330_desc *pl330_get_desc(struct dma_pl330_chan *pch) struct dma_pl330_dmac *pdmac = pch->dmac; u8 *peri_id = pch->chan.private; struct dma_pl330_desc *desc; + int i = 0; /* Pluck one desc from the pool of DMAC */ desc = pluck_desc(pdmac); /* If the DMAC pool is empty, alloc new */ if (!desc) { - if (!add_desc(pdmac, GFP_ATOMIC, 1)) - return NULL; + for(i = 0; i < 3; i++) { + if (!add_desc(pdmac, GFP_ATOMIC, 1)) + continue; - /* Try again */ - desc = pluck_desc(pdmac); - if (!desc) { - dev_err(pch->dmac->pif.dev, - "%s:%d ALERT!\n", __func__, __LINE__); - return NULL; + /* Try again */ + desc = pluck_desc(pdmac); + if (!desc) { + dev_err(pch->dmac->pif.dev, + "%s:%d i=%d ALERT!\n", __func__, __LINE__,i); + continue; + } + break; } + + if(!desc && i >= 3) + return NULL; } /* Initialize the descriptor */ -- 2.34.1