summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/nand/raw/cortina_nand.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/mtd/nand/raw/cortina_nand.c b/drivers/mtd/nand/raw/cortina_nand.c
index 06918a46e93..a27a6994f56 100644
--- a/drivers/mtd/nand/raw/cortina_nand.c
+++ b/drivers/mtd/nand/raw/cortina_nand.c
@@ -186,14 +186,13 @@ int init_nand_dma(struct nand_chip *nand)
info->tx_desc = malloc_cache_aligned((sizeof(struct tx_descriptor_t) *
CA_DMA_DESC_NUM));
- info->rx_desc = malloc_cache_aligned((sizeof(struct rx_descriptor_t) *
- CA_DMA_DESC_NUM));
-
- if (!info->rx_desc && info->tx_desc) {
+ if (!info->tx_desc) {
printf("Fail to alloc DMA descript!\n");
- kfree(info->tx_desc);
return -ENOMEM;
- } else if (info->rx_desc && !info->tx_desc) {
+ }
+ info->rx_desc = malloc_cache_aligned((sizeof(struct rx_descriptor_t) *
+ CA_DMA_DESC_NUM));
+ if (!info->rx_desc) {
printf("Fail to alloc DMA descript!\n");
kfree(info->tx_desc);
return -ENOMEM;