linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sh: fix Oops in the serial SCI driver
@ 2010-05-21 15:22   ` Guennadi Liakhovetski
  2010-05-22  8:10     ` Paul Mundt
  0 siblings, 1 reply; 2+ messages in thread
From: Guennadi Liakhovetski @ 2010-05-21 15:22 UTC (permalink / raw)
  To: linux-sh@vger.kernel.org; +Cc: linux-serial

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>
---
 drivers/serial/sh-sci.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 304a877..7b273c9 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -1007,8 +1007,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);
 }
-- 
1.6.2.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sh: fix Oops in the serial SCI driver
  2010-05-21 15:22   ` [PATCH] sh: fix Oops in the serial SCI driver Guennadi Liakhovetski
@ 2010-05-22  8:10     ` Paul Mundt
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Mundt @ 2010-05-22  8:10 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: linux-sh@vger.kernel.org, linux-serial, Dan Williams

On Fri, May 21, 2010 at 05:22:40PM +0200, Guennadi Liakhovetski wrote:
> Fix an Oops, triggering, if the DMA buffer allocation for the Rx channel in
> sh-sci.c fails.

On Fri, May 21, 2010 at 05:28:51PM +0200, Guennadi Liakhovetski wrote:
> This prevents the driver from unloading, while it is in use. Unloading of the
> driver, while its DMA channels are held, leads to a kernel Oops.

On Fri, May 21, 2010 at 05:30:12PM +0200, Guennadi Liakhovetski wrote:
> If all descriptors on a channel are terminated or the channel is released,
> update the completed cookie counter to match the last cookie. This prevents
> inconsistency warning on resumed DMA operation.

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-22  8:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <Pine.LNX.4.64.1005211728520.8450@axis700.grange>
     [not found] ` <Pine.LNX.4.64.1005211722410.8450@axis700.grange>
2010-05-21 15:22   ` [PATCH] sh: fix Oops in the serial SCI driver Guennadi Liakhovetski
2010-05-22  8:10     ` Paul Mundt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).