diff options
Diffstat (limited to 'drivers/tty/serial/8250/8250_dma.c')
-rw-r--r-- | drivers/tty/serial/8250/8250_dma.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c index ab9096dc3849..148ffe4c232f 100644 --- a/drivers/tty/serial/8250/8250_dma.c +++ b/drivers/tty/serial/8250/8250_dma.c | |||
@@ -192,21 +192,28 @@ int serial8250_request_dma(struct uart_8250_port *p) | |||
192 | 192 | ||
193 | dma->rx_buf = dma_alloc_coherent(dma->rxchan->device->dev, dma->rx_size, | 193 | dma->rx_buf = dma_alloc_coherent(dma->rxchan->device->dev, dma->rx_size, |
194 | &dma->rx_addr, GFP_KERNEL); | 194 | &dma->rx_addr, GFP_KERNEL); |
195 | if (!dma->rx_buf) { | 195 | if (!dma->rx_buf) |
196 | dma_release_channel(dma->rxchan); | 196 | goto err; |
197 | dma_release_channel(dma->txchan); | ||
198 | return -ENOMEM; | ||
199 | } | ||
200 | 197 | ||
201 | /* TX buffer */ | 198 | /* TX buffer */ |
202 | dma->tx_addr = dma_map_single(dma->txchan->device->dev, | 199 | dma->tx_addr = dma_map_single(dma->txchan->device->dev, |
203 | p->port.state->xmit.buf, | 200 | p->port.state->xmit.buf, |
204 | UART_XMIT_SIZE, | 201 | UART_XMIT_SIZE, |
205 | DMA_TO_DEVICE); | 202 | DMA_TO_DEVICE); |
203 | if (dma_mapping_error(dma->txchan->device->dev, dma->tx_addr)) { | ||
204 | dma_free_coherent(dma->rxchan->device->dev, dma->rx_size, | ||
205 | dma->rx_buf, dma->rx_addr); | ||
206 | goto err; | ||
207 | } | ||
206 | 208 | ||
207 | dev_dbg_ratelimited(p->port.dev, "got both dma channels\n"); | 209 | dev_dbg_ratelimited(p->port.dev, "got both dma channels\n"); |
208 | 210 | ||
209 | return 0; | 211 | return 0; |
212 | err: | ||
213 | dma_release_channel(dma->rxchan); | ||
214 | dma_release_channel(dma->txchan); | ||
215 | |||
216 | return -ENOMEM; | ||
210 | } | 217 | } |
211 | EXPORT_SYMBOL_GPL(serial8250_request_dma); | 218 | EXPORT_SYMBOL_GPL(serial8250_request_dma); |
212 | 219 | ||