]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
sh: fix Oops in the serial SCI driver
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Fri, 21 May 2010 15:22:40 +0000 (15:22 +0000)
committerPaul Mundt <lethal@linux-sh.org>
Sat, 22 May 2010 08:06:34 +0000 (17:06 +0900)
Fix an Oops, triggering, if the DMA buffer allocation for the Rx channel in
sh-sci.c fails.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
drivers/serial/sh-sci.c

index 4f73fb756745cc19a2ddce3f62302369579aa1df..5f90fcd7d107573312bbd44ab7be8839ab61b567 100644 (file)
@@ -1004,8 +1004,9 @@ static void sci_rx_dma_release(struct sci_port *s, bool enable_pio)
        s->chan_rx = NULL;
        s->cookie_rx[0] = s->cookie_rx[1] = -EINVAL;
        dma_release_channel(chan);
-       dma_free_coherent(port->dev, s->buf_len_rx * 2,
-                         sg_virt(&s->sg_rx[0]), sg_dma_address(&s->sg_rx[0]));
+       if (sg_dma_address(&s->sg_rx[0]))
+               dma_free_coherent(port->dev, s->buf_len_rx * 2,
+                                 sg_virt(&s->sg_rx[0]), sg_dma_address(&s->sg_rx[0]));
        if (enable_pio)
                sci_start_rx(port);
 }