  					   dma->tx_size, DMA_MEM_TO_DEV,
  					   DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
  	if (!desc) {
-@@ -222,8 +234,9 @@ int serial8250_request_dma(struct uart_8250_port *p)
+@@ -217,20 +229,27 @@ int serial8250_request_dma(struct uart_8250_port *p)
  	}
  
  	/* TX buffer */
 +	dma->tx_buf = kmalloc(UART_XMIT_SIZE, GFP_KERNEL);
++	if (!dma->tx_buf) {
++		ret = -ENOMEM;
++		goto free_coherent_rx;
++	}
++
  	dma->tx_addr = dma_map_single(dma->txchan->device->dev,
 -					p->port.state->xmit.buf,
 +					dma->tx_buf,
  					UART_XMIT_SIZE,
  					DMA_TO_DEVICE);
  	if (dma_mapping_error(dma->txchan->device->dev, dma->tx_addr)) {
-@@ -262,6 +275,8 @@ void serial8250_release_dma(struct uart_8250_port *p)
+-		dma_free_coherent(dma->rxchan->device->dev, dma->rx_size,
+-				  dma->rx_buf, dma->rx_addr);
+ 		ret = -ENOMEM;
+-		goto err;
++		goto free_coherent_rx;
+ 	}
+ 
+ 	dev_dbg_ratelimited(p->port.dev, "got both dma channels\n");
+ 
+ 	return 0;
++free_coherent_rx:
++	dma_free_coherent(dma->rxchan->device->dev, dma->rx_size,
++				dma->rx_buf, dma->rx_addr);
+ err:
+ 	dma_release_channel(dma->txchan);
+ release_rx:
+@@ -257,6 +276,8 @@ void serial8250_release_dma(struct uart_8250_port *p)
  	dmaengine_terminate_sync(dma->txchan);
  	dma_unmap_single(dma->txchan->device->dev, dma->tx_addr,
  			 UART_XMIT_SIZE, DMA_TO_DEVICE);

 	size_t			rx_size;
 	size_t			tx_size;
diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c
index bfa1a857f3ff..466e976308de 100644
--- a/drivers/tty/serial/8250/8250_dma.c
+++ b/drivers/tty/serial/8250/8250_dma.c
@@ -8,6 +8,7 @@

+	memcpy(dma->tx_buf, xmit->buf + xmit->tail, chunk1);
+	
+	chunk2 = CIRC_CNT(head, xmit->tail, UART_XMIT_SIZE) - chunk1;
+	if (chunk2 > 0) {
+		memcpy(dma->tx_buf + chunk1, xmit->buf, chunk2);
+	}
+	dma->tx_size = chunk1 + chunk2;
