drivers: dma_xmc4xxx: Clear request before callback when overrun happens

If an overrun happens the user may decide to stop the dma which
unsets the DMA line. Currently, the line is always re-enabled after the
callback.

Switch the order around to fix the problem. Also, always reset the line
even if the user doesn't provide a callback.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
diff --git a/drivers/dma/dma_xmc4xxx.c b/drivers/dma/dma_xmc4xxx.c
index 50a2745..ffe7b96 100644
--- a/drivers/dma/dma_xmc4xxx.c
+++ b/drivers/dma/dma_xmc4xxx.c
@@ -101,12 +101,9 @@
 		struct dma_xmc4xxx_channel *dma_channel;
 
 		dma_channel = &dev_data->channels[i];
-		if (dma_channel->cb && dma_channel->dlr_line != DLR_LINE_UNSET &&
+		if (dma_channel->dlr_line != DLR_LINE_UNSET &&
 		    sr_overruns & BIT(dma_channel->dlr_line)) {
 
-			LOG_ERR("Overruns detected on channel %d", i);
-			dma_channel->cb(dev, dma_channel->user_data, i, -EIO);
-
 			/* From XMC4700/4800 reference documentation - Section 4.4.1 */
 			/* Once the overrun condition is entered the user can clear the */
 			/* overrun status bits by writing to the DLR_OVRCLR register. */
@@ -114,6 +111,11 @@
 			/* disabling and enabling the respective line. */
 			DLR->LNEN &= ~BIT(dma_channel->dlr_line);
 			DLR->LNEN |= BIT(dma_channel->dlr_line);
+
+			LOG_ERR("Overruns detected on channel %d", i);
+			if (dma_channel->cb != NULL) {
+				dma_channel->cb(dev, dma_channel->user_data, i, -EIO);
+			}
 		}
 	}
 }