@@ -364,7 +364,7 @@ static void sprd_rx_free_buf(struct sprd_uart_port *sp)
if (sp->rx_dma.virt)
dma_free_coherent(sp->port.dev, SPRD_UART_RX_SIZE,
sp->rx_dma.virt, sp->rx_dma.phys_addr);
-
+ sp->rx_dma.virt = NULL;
}
static int sprd_rx_dma_config(struct uart_port *port, u32 burst)
@@ -1203,7 +1203,7 @@ static int sprd_probe(struct platform_device *pdev)
ret = uart_register_driver(&sprd_uart_driver);
if (ret < 0) {
pr_err("Failed to register SPRD-UART driver\n");
- return ret;
+ goto free_rx_buf;
}
}
sprd_ports_num++;
@@ -1222,7 +1222,8 @@ static int sprd_probe(struct platform_device *pdev)
sprd_port[index] = NULL;
sprd_ports_num--;
uart_unregister_driver(&sprd_uart_driver);
- sprd_remove(pdev);
+free_rx_buf:
+ sprd_rx_free_buf(sport);
return ret;
}