diff options
author | Ye.Li <ye.li@nxp.com> | 2016-01-13 10:06:59 +0800 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2016-03-25 11:48:34 +0800 |
commit | ff3923f294cc2e15f436d7520b4042736b1b48a6 (patch) | |
tree | 179e8d6d8148dd13e3748c23da83e25385b84bfd /drivers | |
parent | 78f620a6d6ab44bd34e42f00abe4673db099ca73 (diff) | |
download | u-boot-imx-ff3923f294cc2e15f436d7520b4042736b1b48a6.zip u-boot-imx-ff3923f294cc2e15f436d7520b4042736b1b48a6.tar.gz u-boot-imx-ff3923f294cc2e15f436d7520b4042736b1b48a6.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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/dma/apbh_dma.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/dma/apbh_dma.c b/drivers/dma/apbh_dma.c index a6dc935..25e8b4a 100644 --- a/drivers/dma/apbh_dma.c +++ b/drivers/dma/apbh_dma.c @@ -5,7 +5,7 @@ * on behalf of DENX Software Engineering GmbH * * Based on code from LTIB: - * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright (C) 2010-2016 Freescale Semiconductor, Inc. All Rights Reserved. * * SPDX-License-Identifier: GPL-2.0+ */ @@ -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; |