dma: bcm6348: check if driver is enabled before send/recv
authorÁlvaro Fernández Rojas <noltari@gmail.com>
Fri, 22 Mar 2019 17:22:31 +0000 (18:22 +0100)
committerDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
Fri, 12 Apr 2019 15:32:50 +0000 (17:32 +0200)
This patch prevents errors when running tftpput.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
drivers/dma/bcm6348-iudma.c

index 1d3c192cfe5bb983bcd49168d3f1b558c20bac5f..e7bd1b2350f48f4bb83581edb768c5a75d6b2d81 100644 (file)
@@ -324,6 +324,9 @@ static int bcm6348_iudma_receive(struct dma *dma, void **dst, void *metadata)
        struct bcm6348_dma_desc *dma_desc = dma_desc = ch_priv->dma_ring;
        int ret;
 
+       if (!ch_priv->running)
+               return -EINVAL;
+
        /* get dma ring descriptor address */
        dma_desc += ch_priv->desc_id;
 
@@ -369,6 +372,9 @@ static int bcm6348_iudma_send(struct dma *dma, void *src, size_t len,
        struct bcm6348_dma_desc *dma_desc;
        uint16_t status;
 
+       if (!ch_priv->running)
+                return -EINVAL;
+
        /* flush cache */
        bcm6348_iudma_fdc(src, len);