summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYe.Li <ye.li@nxp.com>2016-01-13 10:06:59 +0800
committerguoyin.chen <guoyin.chen@freescale.com>2016-03-04 15:53:38 +0800
commit58b76def496c69cd3eb03f114da24b3dd5a380c1 (patch)
tree783f1436c53f4f758f7647dbe1cf8704b0806dff
parent8f6f4bd1baf57ad32673ca2f69d2f8baa5a8bc8f (diff)
downloadu-boot-imx-58b76def496c69cd3eb03f114da24b3dd5a380c1.zip
u-boot-imx-58b76def496c69cd3eb03f114da24b3dd5a380c1.tar.gz
u-boot-imx-58b76def496c69cd3eb03f114da24b3dd5a380c1.tar.bz2
MLK-12214 NAND:apbh_dma: Fix logically dead code issue
The list_first_entry always assumes the list is not empty, it won't return NULL pointer when the list is empty. So the "if (pdesc == NULL)" becomes a dead code. Fix the issue by calling the list_empty before the list_first_entry. (Coverity CID 29934) Signed-off-by: Ye.Li <ye.li@nxp.com>
-rw-r--r--drivers/dma/apbh_dma.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/dma/apbh_dma.c b/drivers/dma/apbh_dma.c
index c63f4f6..c65a215 100644
--- a/drivers/dma/apbh_dma.c
+++ b/drivers/dma/apbh_dma.c
@@ -126,10 +126,10 @@ static int mxs_dma_enable(int channel)
return 0;
}
- pdesc = list_first_entry(&pchan->active, struct mxs_dma_desc, node);
- if (pdesc == NULL)
+ if (list_empty(&pchan->active))
return -EFAULT;
-
+
+ pdesc = list_first_entry(&pchan->active, struct mxs_dma_desc, node);
if (pchan->flags & MXS_DMA_FLAGS_BUSY) {
if (!(pdesc->cmd.data & MXS_DMA_DESC_CHAIN))
return 0;